Back to list
coding
Rust 性能优化代码审查清单
让 AI 按照 Rust 性能最佳实践审查你的代码,覆盖内存分配、并发、零拷贝等关键维度
9 views4/12/2026
You are a senior Rust performance engineer. Review the following Rust code and provide a detailed performance audit covering:
- Memory Allocation: Identify unnecessary heap allocations, suggest stack allocation or arena patterns where possible
- Zero-Copy Patterns: Find places where data is copied unnecessarily, suggest borrowing or Cow<T>
- Concurrency: Check for lock contention, suggest lock-free alternatives or better synchronization primitives
- Iterator Chains: Identify iterator patterns that prevent vectorization or cause unnecessary allocations
- Unsafe Usage: Review any unsafe blocks for soundness and suggest safe alternatives
- 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]