perf: use TypedMap for CustomField and document plugin-context resolve rationale#8714
Conversation
Co-authored-by: hyf0 <49502170+hyf0@users.noreply.github.com>
564a2d8
into
perf/replace-typed-dash-map-with-typed-map
There was a problem hiding this comment.
Pull request overview
This PR documents and reinforces the design choice that PluginContextResolveOptions::custom is populated up-front and then shared read-only, aligning CustomField with a non-concurrent TypedMap-backed approach and capturing when that decision should be revisited.
Changes:
- Add a design note describing why
PluginContextResolveOptions::customusesCustomFieldbacked byTypedMap(notTypedDashMap). - Add an in-code reference from
CustomFieldto the design note for discoverability.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| meta/design/plugin-context-resolve.md | New design note documenting the CustomField backing rationale and future pivot point. |
| crates/rolldown_plugin/src/types/custom_field.rs | Adds a pointer comment to the design note near the TypedMap backing type alias. |
You can also share your feedback on Copilot code review. Take the survey.
| // See meta/design/plugin-context-resolve.md. | ||
| type Inner = TypedMap<(), typedmap::SyncAnyBounds, typedmap::SyncAnyBounds, FxBuildHasher>; | ||
|
|
Benchmarks Rust |
Merging this PR will not alter performance
Comparing Footnotes
|
CustomFieldwas usingTypedDashMapeven though plugin-context resolve treats it as write-once, then shared read-only state. This switchesCustomFieldtoTypedMapto remove unnecessary DashMap shard overhead and adds a short design note capturing when that choice should be revisited.CustomField storage
TypedDashMapwithTypedMapinCustomFieldArc, then read through resolve/load flowstypedmapdashmapfeature from the dependency configurationCall site adjustments
CustomFieldconstruction sites to insert values before sharingDerefMutsupport so existing typed-map usage stays direct and localDesign note
meta/design/plugin-context-resolve.mdPluginContextResolveOptions::customTypedDashMapif plugin-context resolve starts requiring shared concurrent mutationCode reference
CustomFieldback to the design note so the storage choice is easy to rediscover from the implementation✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.