perf: introduce pre-computed hashing for ArcPath#11651
Merged
Conversation
✅ Deploy Preview for rspack canceled.
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
Optimizes path handling performance by introducing precomputed hash caching for ArcPath and replacing usage with specialized hash set types across the codebase.
- Refactored
ArcPathto store precomputed hash values for O(1) hashing operations - Introduced optimized collection types (
ArcPathSet,ArcPathMap, etc.) usingIdentityHasher - Updated all modules to use new path collection types instead of generic hash collections
Reviewed Changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rspack_paths/src/lib.rs | Core implementation of optimized ArcPath with precomputed hashing and new collection type definitions |
| crates/rspack_paths/Cargo.toml | Added required dependencies for hashing and concurrent collections |
| crates/rspack_plugin_lazy_compilation/src/module.rs | Updated to use ArcPathSet instead of generic hash sets |
| crates/rspack_plugin_lazy_compilation/src/dependency.rs | Updated dependency path collections to use optimized types |
| crates/rspack_plugin_extract_css/src/css_dependency.rs | Migrated CSS dependency path collections to use FxArcPathSet |
| crates/rspack_fs/src/watcher/*.rs | Updated file system watcher components to use ArcPathDashSet |
| crates/rspack_core/src/**/*.rs | Comprehensive migration of core module path handling to optimized collection types |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
8190a82 to
b545a24
Compare
Contributor
|
📝 Benchmark detail: Open
|
Contributor
📦 Binary Size-limit
🙈 Size remains the same at 47.43MB |
CodSpeed Performance ReportMerging #11651 will not alter performanceComparing Summary
|
quininer
reviewed
Sep 12, 2025
quininer
approved these changes
Sep 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a significant performance optimization for ArcPath by pre-computing and caching its hash value. ArcPath is used extensively throughout the codebase as a key in HashMap and HashSet (including concurrent versions like DashMap). Previously, every hash operation (e.g., insert, get) required re-calculating the hash by iterating over the entire path string, leading to substantial and repetitive CPU overhead.
Related links
Checklist