-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode_optimization.hbs
46 lines (34 loc) · 1.55 KB
/
code_optimization.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Project Path: {{ absolute_code_path }}
Source Tree:
```
{{ source_tree }}
```
## Code
{{#each files}}
{{#if code}}
`{{path}}`:
{{code}}
{{/if}}
{{/each}}
## Request
I'd like your help improving the performance of my code. It works correctly, but I need it to be faster and more efficient.
When looking for optimization opportunities, consider:
- Algorithm complexity and big O analysis
- Expensive operations like disk/network I/O
- Unnecessary iterations or computations
- Repeated calculations of the same value
- Inefficient data structures or data types
- Opportunities to cache or memoize results
- Parallelization with threads/async
- More efficient built-in functions or libraries
- Query or code paths that can be short-circuited
- Reducing memory allocations and copying
- Compiler or interpreter optimizations to leverage
For each potential improvement, provide:
1. File path and line number(s)
2. Description of the issue/inefficiency
3. Estimated impact on performance
4. Specific suggestions for optimization
Then update the code with your changes. Be sure to maintain readability and organization. Minor optimizations that significantly reduce clarity are not worth it.
Add benchmarks if possible to quantify the performance improvements. Document any new usage constraints (e.g. increased memory requirements).
Try to prioritize the changes that will have the largest impact on typical usage scenarios based on your understanding of the codebase. If the existing code is already well optimized then let me know and explain why it is well optimized.