Skip to content

chore: establish performance baselines#41

Merged
hyfdev merged 1 commit into
mainfrom
agent/performance-baselines
Jul 12, 2026
Merged

chore: establish performance baselines#41
hyfdev merged 1 commit into
mainfrom
agent/performance-baselines

Conversation

@hyfdev

@hyfdev hyfdev commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace the ad hoc Criterion cases with a Rolldown-shaped workload corpus and stable IDs named by input ownership and requested result
  • pin Rust, Cargo dependencies, and mimalloc-backed benchmark settings; run CodSpeed in simulation and memory modes
  • add a deterministic allocation tracker with committed native macOS ARM64, Linux GNU, and Windows MSVC snapshots for default and cached_current_dir
  • keep Docker/Wine Windows-GNU steps as explicitly gated optional documentation only

Why

PR #40 currently introduces most of this measurement infrastructure together with the API and implementation rewrite, so CodSpeed has no accepted pre-optimization run for the important rows and reports them as new benchmarks. This PR runs the existing v2 implementation against the same inputs and requested outputs first.

Where v2 has no consuming API, the borrowed- and owned-receiver baseline rows deliberately execute the same operation. After this lands, #40 can keep these IDs and replace only the owned-receiver body, making time and allocation changes directly visible.

Merge this PR first and let CodSpeed record it on main; then rebase/update #40 to preserve these benchmark and allocation scenario identities. Rows whose breaking API intentionally changes the returned spelling or root semantics remain contract coverage and are documented as unsuitable for same-output speed claims.

Scope and impact

  • no src/**, test, public API, version, or changelog changes
  • published crate contents exclude repository-only benchmark evidence and CI files
  • no Docker, Wine, or container command was run

Validation

  • cargo fmt --all -- --check
  • cargo test --locked --workspace
  • cargo test --locked --workspace --all-features
  • cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --locked --workspace --all-features --no-deps
  • cargo bench --locked --workspace --no-run
  • cargo bench --locked --workspace --all-features --no-run
  • native macOS default/Rolldown allocation snapshot checks
  • native Linux/Windows snapshot generation and macOS/Linux/Windows test matrix in GitHub Actions
  • cargo package --locked --allow-dirty

@codspeed-hq

codspeed-hq Bot commented Jul 12, 2026

Copy link
Copy Markdown

Merging this PR will create unknown performance changes

🆕 216 new benchmarks
⏩ 30 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
🆕 Simulation clean_absolute N/A 1.4 µs N/A
🆕 Simulation relative N/A 4 µs N/A
🆕 Simulation std_path_new N/A 197.5 ns N/A
🆕 Simulation str N/A 197.5 ns N/A
🆕 Simulation string N/A 226.7 ns N/A
🆕 Simulation normalize/canonical_leading_parents[leading_parents] N/A 2.3 µs N/A
🆕 Simulation normalize/clean_rolldown[fixture_p50] N/A 1.3 µs N/A
🆕 Simulation normalize/clean_rolldown[fixture_p90] N/A 1.3 µs N/A
🆕 Simulation normalize/clean_rolldown[fixture_p95] N/A 1.3 µs N/A
🆕 Simulation normalize/clean_rolldown[fixture_p99] N/A 1.4 µs N/A
🆕 Simulation normalize/clean_rolldown[module_loader_hot] N/A 1.3 µs N/A
🆕 Simulation normalize/clean_rolldown[short_source] N/A 1.1 µs N/A
🆕 Simulation normalize/current_directory_spellings[collapsing] N/A 2.6 µs N/A
🆕 Simulation normalize/current_directory_spellings[dot_separator] N/A 1.7 µs N/A
🆕 Simulation normalize/current_directory_spellings[dot] N/A 1.7 µs N/A
🆕 Simulation normalize/current_directory_spellings[empty] N/A 1.1 µs N/A
🆕 Simulation lexically_clean N/A 2.5 µs N/A
🆕 Simulation normalize/leading_parent_prescan[clean_68b] N/A 2.8 µs N/A
🆕 Simulation normalize/leading_parent_prescan[dirty_early_67b] N/A 2.7 µs N/A
🆕 Simulation normalize/leading_parent_prescan[dirty_late_80b] N/A 3.2 µs N/A
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Comparing agent/performance-baselines (e483f8f) with main (5eec2b0)

Open in CodSpeed

Footnotes

  1. 30 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@hyfdev
hyfdev marked this pull request as ready for review July 12, 2026 05:26
Copilot AI review requested due to automatic review settings July 12, 2026 05:26
@hyfdev
hyfdev merged commit 9e6b627 into main Jul 12, 2026
14 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Establishes a pinned, comparable performance baseline for SugarPath by introducing a deterministic allocation-snapshot harness, reshaping Criterion benches around a Rolldown-like corpus with stable IDs, committing cross-platform allocation snapshots, and wiring CI to validate those baselines.

Changes:

  • Add tasks/track_allocations executable that measures and snapshot-checks global allocator call counts/bytes for a fixed set of SugarPath scenarios.
  • Rework Criterion benches to use Rolldown-shaped workloads and stable benchmark identifiers; add a dedicated rolldown bench.
  • Pin toolchain/deps and CI behavior (Rust 1.97.0, committed Cargo.lock, tuned bench profile, allocation snapshot checks, CodSpeed simulation+memory).

Reviewed changes

Copilot reviewed 27 out of 29 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tasks/track_allocations/src/main.rs New allocation tracking executable with deterministic scenarios and snapshot rendering/checking.
tasks/track_allocations/README.md Documents how to generate/check allocation snapshots and interpret results.
tasks/track_allocations/Cargo.toml Defines the non-published workspace task crate and rolldown feature flag.
tasks/track_allocations/.gitignore Ignores the task’s local target/ output.
rust-toolchain.toml Pins the Rust toolchain and required components.
Cargo.toml Converts repo to a workspace, pins bench profile settings, adds deps/benches, and sets publish exclusions.
Cargo.lock Commits a locked dependency graph for reproducible benchmark baselines.
.cargo/config.toml Adds cargo allocs / cargo allocs-rolldown aliases for snapshot workflows.
benchmarks/README.md Explains the baseline philosophy (Criterion vs CodSpeed vs allocations) and usage.
benchmarks/windows-gnu.md Optional/gated Docker+Wine instructions for Windows-GNU reproduction.
benchmarks/rolldown-path-distribution.sh Script to summarize Rolldown path distribution for workload justification.
benchmarks/allocations/x86_64-unknown-linux-gnu-default.snap Committed Linux default allocation snapshot baseline.
benchmarks/allocations/x86_64-unknown-linux-gnu-rolldown.snap Committed Linux cached_current_dir allocation snapshot baseline.
benchmarks/allocations/x86_64-pc-windows-msvc-default.snap Committed Windows MSVC default allocation snapshot baseline.
benchmarks/allocations/x86_64-pc-windows-msvc-rolldown.snap Committed Windows MSVC cached_current_dir allocation snapshot baseline.
benchmarks/allocations/aarch64-apple-darwin-default.snap Committed macOS ARM64 default allocation snapshot baseline.
benchmarks/allocations/aarch64-apple-darwin-rolldown.snap Committed macOS ARM64 cached_current_dir allocation snapshot baseline.
benches/support/mod.rs Sets mimalloc as the global allocator for benchmark binaries; exports workloads.
benches/support/workloads.rs New Rolldown-shaped path corpora and relative/to_slash/normalize fixtures (incl. invalid Unicode).
benches/absolutize.rs Reshaped absolutize benchmarks around Rolldown-like paths and explicit cwd strategies.
benches/normalize.rs Replaces ad-hoc fixtures with corpus-based normalize benchmarks and stable IDs.
benches/relative.rs Replaces ad-hoc relative benchmarks with Rolldown-shaped cases and stable IDs.
benches/to_slash.rs Replaces ad-hoc to_slash benchmarks with corpus-based cases, owned-input rows, and Windows branches.
benches/as_path.rs Benchmarks as_path on Rolldown corpus vs Path::new.
benches/rolldown.rs New composed pipeline benchmarks modeling Rolldown call-site shapes and outputs.
benches/fixtures.rs Removes old ad-hoc fixture lists superseded by workload corpus.
.gitignore Stops ignoring Cargo.lock so baselines remain reproducible.
.github/workflows/test.yaml Adds allocation snapshot validation job and tightens test/lint invocations under --locked --workspace.
.github/workflows/codspeed.yml Runs CodSpeed in simulation+memory modes with pinned toolchain and build flags.
Comments suppressed due to low confidence (1)

Cargo.toml:20

  • criterion is imported throughout the benches, but the dev-dependency is declared as criterion2, which means use criterion::... will fail to compile. Rename the dependency key to criterion (using package = "criterion2") and update the codspeed feature to reference the renamed dependency.
[features]
# Enable `cached_current_dir` will make `SugarPath` to only call `std::env::current_dir` once for all path operations.
cached_current_dir = []
codspeed = ["criterion2/codspeed"]


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Cargo.toml
edition = "2024"
license = "MIT"
autobenches = false
exclude = [".agents/", ".cargo/", ".github/", "AGENTS.md", "CLAUDE.md", "benchmarks/"]
Comment thread benches/absolutize.rs
Comment on lines +68 to +75
bencher.iter_with_setup_wrapper(|runner| {
let base = PathBuf::from(black_box(ROLLDOWN_ROOT));
runner.run(|| {
let input = Path::new(black_box(RELATIVE_MODULE));
let output = input.absolutize_with(Cow::Owned(base));
drop(black_box(output));
});
});
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