Skip to content

Conversation

@hubertshelley
Copy link
Member

This PR merges performance_optimization into main.\n\nHighlights:\n- Merge PR005 benchmark and xtask into branch.\n- Fix connection refused under load by reverting Arc handler usage.\n- Restore Request query parsing semantics (no OnceLock cache).\n- Minor perf optimizations in routing and service layers.\n\nPre-commit status: fmt, clippy, check, deny, tests all pass.

- 新增 xtask bench:支持 A/B/C 场景、--format json|csv、--out-file、--prune
- JSON 裁剪仅保留关键指标并加入本地时间戳与机器信息
- 运行前预检 bombardier;缺失 curl 时对场景 C 降级处理
- 写入文件前自动创建目录并确保输出纯净(隐藏进度条与多余日志)
- 补充 benchmark 脚本与文档说明
将所有 let _ = route.call(req) 替换为 std::mem::drop(route.call(req)),避免非绑定 Future 警告。已通过 cargo clippy 与 cargo build 验证。

Closes: 基准中的 Clippy 非绑定 Future 警告清理完成。
Request: 使用 OnceLock 缓存 query 参数,params()/params_parse() 改为 &self,避免重复解析

CORS: 预构建并缓存静态响应头,仅动态处理 Origin

RouteTree: 为 Arc<RouteTree> 实现 Handler;预分配中间件收集容量

Serve/HyperService: 通过 Arc 传递路由,减少克隆

benchmark: 补充 tokio/serde 依赖;更显式地丢弃 bench 调用结果;规范配置

其他: 将 AGENTS.md 加入 .gitignore

影响: 无行为变更;API 借用更宽松(&mut self -> &self)
…teTree> handler usage and Request query OnceLock caching; restore PR005 semantics for route cloning and params parsing
@hubertshelley hubertshelley merged commit 0f00c0b into main Aug 21, 2025
1 check passed
@hubertshelley hubertshelley deleted the performance_optimization branch August 21, 2025 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants