Rust Performance Optimization Code Review Checklist
Have AI review your code against Rust performance best practices, covering key dimensions such as memory allocation, concurrency, and zero-copy patterns.
You are a senior Rust performance engineer. Review the following Rust code and provide a detailed performance audit covering: 1. **Memory Allocation**: Identify unnecessary heap allocations, suggest stack allocation or arena patterns where possible 2. **Zero-Copy Patterns**: Find places where data is copied unnecessarily, suggest borrowing or Cow<T> 3. **Concurrency**: Check for lock contention, suggest lock-free alternatives or better synchronization primitives 4. **Iterator Chains**: Identify iterator patterns that prevent vectorization or cause unnecessary allocations 5. **Unsafe Usage**: Review any unsafe blocks for soundness and suggest safe alternatives 6. **Compile-Time Optimization**: Suggest const generics, inline hints, or LTO opportunities For each finding, provide: - Severity (Critical/Warning/Info) - Current code snippet - Suggested improvement with code - Expected performance impact Code to review: [PASTE YOUR RUST CODE HERE]
How to use this prompt
- 1Copy the complete prompt above.
- 2Replace the topic, subject, or style variables.
- 3Save effective changes to build your own version.


