Skip to content

perf: avoid redundant relative scans on macOS ARM64#50

Merged
hyfdev merged 1 commit into
mainfrom
agent/relative-suffix-scan-20260714
Jul 14, 2026
Merged

perf: avoid redundant relative scans on macOS ARM64#50
hyfdev merged 1 commit into
mainfrom
agent/relative-suffix-scan-20260714

Conversation

@hyfdev

@hyfdev hyfdev commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Scan the shared component prefix before normalization classification for absolute relative calls on macOS AArch64 with NEON.
  • Validate only unmatched suffixes when an upward result is already necessarily owned, while retaining full-input validation before borrowing descendants.
  • Record Windows, macOS, and Linux as the performance targets; other platforms remain correctness-supported but are not performance goals.
  • Add exhaustive short-path result and Cow parity coverage plus multibyte UTF-8 prefix and mismatch cases.

Scope

The optimized implementation is compiled only for macOS AArch64 with NEON. macOS x86_64, Windows, Linux, and other operating systems compile the previous implementation unchanged. This PR adds no unsafe and no new benchmark cases.

Performance

Compared with accepted baseline commit 886fc357f228e8a89e49103fdaa88db7eab70877 on an Apple M3 Pro using the existing relative benchmark, with freshly built binaries in isolated target directories, 150 samples, a 2-second warm-up, and a 5-second measurement:

Existing case Natural result PathBuf result
short_common_prefix 9.41% faster 9.37% faster
deep_siblings 68.31% faster 68.58% faster
different_subtrees 27.83% faster 29.84% faster
module_to_cwd no change within 1% noise
same_directory within noise 3.17% faster

Two full dot_slow_path comparisons moved in opposite directions: one owned-result run regressed by 2.73%, then the repeat improved by 1.94%. A balanced eight-run alternation did not reproduce a regression, so this row is treated as having no demonstrated change rather than as a gain.

AArch64 release IR grows from 16,665 lines and 430 copies to 16,777 lines and 431 copies. macOS x86_64 remains exactly 15,469 lines and 385 copies.

Validation

  • cargo fmt --all -- --check
  • cargo test --all-features
  • cargo clippy --all-targets --all-features -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
  • cargo check --lib --target x86_64-pc-windows-gnu
  • cargo check --lib --target x86_64-pc-windows-msvc
  • cargo check --lib --target x86_64-unknown-linux-gnu

An independent adversarial review found no remaining correctness, ownership, UTF-8, platform-scope, or safety blocker.

@codspeed-hq

codspeed-hq Bot commented Jul 14, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 228 untouched benchmarks
⏩ 38 skipped benchmarks1


Comparing agent/relative-suffix-scan-20260714 (bfc7218) with main (886fc35)

Open in CodSpeed

Footnotes

  1. 38 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 14, 2026 07:21
Copilot AI review requested due to automatic review settings July 14, 2026 07:21

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@hyfdev
hyfdev merged commit 7123f3c into main Jul 14, 2026
9 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 13, 2026
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