-
Notifications
You must be signed in to change notification settings - Fork 145
/
improve-performance.hbs
42 lines (32 loc) · 1.52 KB
/
improve-performance.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
Project Path: {{ absolute_code_path }}
I'd like your help improving the performance of this codebase. It works correctly, but we need it to be faster and more efficient. Analyze the code thoroughly with this goal in mind:
Source Tree:
```
{{ source_tree }}
```
{{#each files}}
{{#if code}}
`{{path}}`:
{{code}}
{{/if}}
{{/each}}
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. Let me know if you have any questions!