Skip to content

Commit

Permalink
add code optimization template
Browse files Browse the repository at this point in the history
  • Loading branch information
seankim658 committed Jul 18, 2024
1 parent 47f36ca commit b09ea10
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/templates/code_optimization.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Project Path: {{ absolute_code_path }}

Source Tree:
```
{{ source_tree }}
```

{{#each files}}
{{#if code}}
`{{path}}`:

{{code}}

{{/if}}
{{/each}}

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.

0 comments on commit b09ea10

Please sign in to comment.