Commit 51aa50a
authored
⚡️ Speed up function
Here is an optimized version of your function. The largest bottleneck identified is from the unnecessary use of `dict(**kwargs)`, which creates a new dictionary from kwargs, but since `kwargs` is already a dictionary, this is just a redundant and potentially slower operation. You can use `kwargs` directly, which saves both CPU and memory.
**Explanation:**
- Returning `kwargs` as is avoids an unnecessary dictionary copy, achieving lower runtime and memory usage.
- The return value is unchanged: the `"params"` entry will be the dictionary of arguments supplied via `**kwargs`.
This is the fastest and leanest way to implement your functionality per the profiling results._operation by 80%1 parent bb13521 commit 51aa50a
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
0 commit comments