| Reduce allocations | Pre-allocate, reuse | withcapacity, object pools | | Improve cache | Contiguous data | Vec, SmallVec | | Parallelize | Data parallelism | rayon, threads | | Avoid copies | Zero-copy | References, Cow | | Reduce indirection | Inline data | smallvec, arrays |
| Latency requirements | domain- | What's acceptable response time? | | Throughput needs | domain- | How many requests per second? | | Memory constraints | domain- | What's the memory budget? |
| cargo bench | Micro-benchmarks | | criterion | Statistical benchmarks | | perf / flamegraph | CPU profiling | | heaptrack | Allocation tracking | | valgrind / cachegrind | Cache analysis |
КРИТИЧНО: используйте для оптимизации производительности. Триггеры: производительность, оптимизация, тест, профилирование, Flamegraph, критерий, медленно, быстро, распределение, кэш, SIMD, сделать это быстрее, 性能优化, 基准测试 Источник: zhanghandong/rust-skills.