[codex] Use camino UTF-8 path API#221
Conversation
Merging this PR will improve performance by 5.92%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Memory | resolver[multi-thread] |
11 MB | 10.4 MB | +5.92% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing codex/camino-utf8-path-api (06d9e46) with main (0616bdc)
|
Performance follow-up: aligned cache path keys with the previous std path behavior in |
|
@codspeedbot explain why this is faster |
Based on my analysis of the CodSpeed flamegraphs and the code changes in this PR, here's why the Root Cause: Eliminated String Conversion Allocations in Hot PathsThe switch from Where the Savings Show UpComparing the flamegraph memory breakdowns between BASE and HEAD, the largest reductions are concentrated in two functions:
These are the hottest path-manipulation functions in the resolver — they join paths, look up Cache Key Alignment (Commit
|
Summary
std::path::{Path, PathBuf}tocamino::{Utf8Path, Utf8PathBuf}.FileSystemtrait.to_str().expect(...)conversions withUtf8Path::as_str()and explicit std-path boundary conversions.Impact
Callers now pass and receive UTF-8 path types at the Rust API boundary, making the resolver's UTF-8 requirement explicit and avoiding hidden unwraps during internal path-to-string conversion. OS/PnP calls still cross through std paths via
as_std_path(), and canonicalized std paths are converted back with anInvalidDataerror if they are not valid UTF-8.Validation
cargo check --workspacecargo check --benchescargo test --no-runcargo fmt,pnpm exec taplo format,cargo clippy --all-features -- -D warningsNote:
cargo test --libruns and passes 125 tests locally, but 6 PnP runtime tests fail because the localfixtures/pnpdirectory does not contain a.pnp.cjsmanifest forpnp::find_closest_pnp_manifest_pathto discover.