rust-library-performance-features
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRust Library Performance Features
Rust库性能特性
Use this skill when a Rust library needs performance work that can be measured
and shipped behind clear Cargo feature boundaries.
当Rust库需要可量化的性能优化工作,且该优化需封装在清晰的Cargo特性边界后交付时,可使用此技能。
Core Workflow
核心工作流
- Define the library operation and input sizes that matter to downstream users.
- Add or repair benchmarks before optimizing.
- Compare baseline and candidate implementations with the same harness.
- Use Cargo features for optional capabilities and dependencies.
- Test the feature matrix, including default features disabled.
- Document performance claims with scope and measurement commands.
- 明确对下游用户至关重要的库操作和输入规模。
- 在优化前添加或修复基准测试。
- 使用同一测试框架对比基准实现与候选实现。
- 利用Cargo特性来管理可选功能和依赖项。
- 测试特性矩阵,包括禁用默认特性的场景。
- 记录性能声明,包含适用范围和测量命令。
Read Next
后续阅读
| Task | Load |
|---|---|
| Add benchmarks or optimize a hot path | |
| Review Cargo features and optional dependencies | |
| Validate performance claims before release | |
| 任务 | 加载路径 |
|---|---|
| 添加基准测试或优化热点路径 | |
| 审核Cargo特性与可选依赖项 | |
| 发布前验证性能声明 | |
Source Notes
来源说明
Guidance is transformed and paraphrased from Herbert Wolverson,
Advanced Hands-On Rust, especially Chapters 2 and 3 on creating, testing,
optimizing, benchmarking, and feature-gating a library. Examples are original
skeletons.
本指南改编自Herbert Wolverson所著的《Advanced Hands-On Rust》,尤其参考了书中第2章和第3章关于库的创建、测试、优化、基准测试以及特性门控的内容。示例为原创框架。