-
-
Couldn't load subscription status.
- Fork 730
perf: improve source map parse from json #11950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves performance when parsing source maps from JSON by updating the rspack_sources dependency and adapting the codebase to use a new iterator-based API instead of the previous collection-based approach.
Key changes:
- Updates
rspack_sourcesdependency to use a git revision with performance improvements - Refactors code to use iterator methods (
sources(),get_source_content()) instead of collection methods (sources().iter(),sources_content().get()) - Changes
SourceMap::from_slice()calls toSourceMap::from_json()for more efficient parsing
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Updates rspack_sources dependency to git revision with performance improvements |
| crates/rspack_plugin_rsdoctor/src/module_graph.rs | Refactors to use iterator-based source access methods |
| crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs | Removes unnecessary .iter() calls on sources iterator |
| crates/rspack_plugin_devtool/src/eval_source_map_dev_tool_plugin.rs | Removes .iter() call for sources iteration |
| crates/rspack_loader_swc/src/lib.rs | Removes .iter() call for sources iteration |
| crates/rspack_core/src/utils/extract_source_map.rs | Changes sources collection to use iterator with explicit mapping |
| crates/rspack_cacheable/src/with/as_preset/rspack_sources/mod.rs | Removes unnecessary reference in conditional binding |
| crates/rspack_binding_api/src/swc.rs | Replaces JSON serialization with to_json() method |
| crates/rspack_binding_api/src/source.rs | Replaces from_slice() with more efficient from_json() method |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ropey = { version = "1.6.1", default-features = false } | ||
| rspack_resolver = { features = ["package_json_raw_json_api", "yarn_pnp"], version = "0.6.3", default-features = false } | ||
| rspack_sources = { version = "=0.4.11", default-features = false } | ||
| rspack_sources = { git = "https://github.com/SyMind/rspack-sources.git", rev = "1cbefbd08acf0225a9eae9bb4e01084b6886f650", default-features = false } |
Copilot
AI
Oct 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a git dependency with a specific commit instead of a versioned release makes the build less reproducible and harder to audit. Consider publishing this change as a new version of rspack_sources (e.g., 0.4.12) and using a semver dependency instead.
| rspack_sources = { git = "https://github.com/SyMind/rspack-sources.git", rev = "1cbefbd08acf0225a9eae9bb4e01084b6886f650", default-features = false } | |
| rspack_sources = { version = "0.4.12", default-features = false } |
📦 Binary Size-limit
❌ Size increased by 13.88KB from 47.82MB to 47.83MB (⬆️0.03%) |
CodSpeed Performance ReportMerging #11950 will not alter performanceComparing Summary
|
7b5e493 to
29e9cbd
Compare
|
📝 Benchmark detail: Open
|
Summary
Related links
Checklist