Skip to content

[codex] Prehash resolver path dependencies#206

Draft
hardfist wants to merge 4 commits into
mainfrom
codex/prehash-path-dependencies
Draft

[codex] Prehash resolver path dependencies#206
hardfist wants to merge 4 commits into
mainfrom
codex/prehash-path-dependencies

Conversation

@hardfist
Copy link
Copy Markdown
Contributor

@hardfist hardfist commented May 9, 2026

Summary

  • Add PathDependency and ResolvePreHashedContext so callers can consume resolver dependency paths with their precomputed path hash.
  • Reuse the same path hashing helper for the internal path cache and expose the identity hasher needed by the prehashed dependency set.
  • Short-circuit cached path equality by checking the precomputed hash before comparing full paths.
  • Cache each cached directory's package.json path so repeated package-json lookups and dependency recording can reuse the joined path.
  • Clean up the dependency tests so the normal and prehashed dependency expectations share the same collected sets.

Why

Rspack build_module_graph path dependency handling currently hashes dependency paths in the resolver context and then hashes the same paths again when converting them into Rspack prehashed ArcPath sets. This API lets Rspack reuse the resolver-side hash instead of paying for another full Path hash during that conversion.

Validation

  • cargo fmt --check
  • cargo check
  • cargo test tests::dependencies --lib
  • cargo clippy --lib -- -D warnings
  • cargo test package_json
  • Full cargo test was also attempted earlier; 124 tests passed and 6 existing PnP fixture tests failed with NotFound(...), which appears unrelated to this change.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 9, 2026

Merging this PR will degrade performance by 12.19%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 3 regressed benchmarks
✅ 9 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory resolver[multi-thread] 11 MB 12.4 MB -11.32%
Memory resolver[resolve from symlinks] 12 MB 14.1 MB -14.65%
Memory resolver[[single-threaded]resolve with many extensions] 12.8 MB 14.3 MB -10.53%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing codex/prehash-path-dependencies (4eb983f) with main (8975e38)

Open in CodSpeed

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.

1 participant