next.js
53085646 - turbo-bincode: remove indexmap/indexset helpers and use OrderedAutoMap/OrderedAutoSet in cells (#101520)

Commit
2 days ago
turbo-bincode: remove indexmap/indexset helpers and use OrderedAutoMap/OrderedAutoSet in cells (#101520) ### What? Removes `turbo_bincode::indexmap` and `turbo_bincode::indexset`. Every value that stored an `IndexMap`/`IndexSet` through them now stores an `OrderedAutoMap`/`OrderedAutoSet`. ### Why? Without these helpers, `IndexMap`/`IndexSet` fields no longer derive bincode, so they can't be stored in cells. Cells use `OrderedAutoMap`/`OrderedAutoSet` instead: - they keep the insertion order; - they are small for few entries; - their equality is order sensitive, so a reorder is a change. As keyed cells they report no changed key for a pure reorder, so keyed readers stay cached. ### How? - Migrated the 34 `#[bincode(with = "turbo_bincode::indexmap" | "turbo_bincode::indexset")]` fields across turbopack-core, turbopack-ecmascript, turbopack-css, turbopack-browser, turbopack-nodejs, next-core and next-api, together with the code that builds and reads them. - Also migrated the serde-encoded `next.config` maps (`publicRuntimeConfig`, `serverRuntimeConfig`, `turbopack.resolveAlias`). They go through `turbo_bincode::serde_self_describing`, so they were cell data too. - `AppPageLoaderTree::parallel_routes` boxes its values: the list storage keeps entries inline and the type is recursive. - Maps that were sorted with `sort_keys` are built through a `BTreeMap` and converted with `From<BTreeMap>`. This keeps the same key order. - The auto-hash-map API this needs (positional access, `Equivalent` lookups, `keys`/`get_key_value`, `from_unique_iterator`, conversions) landed in #101497. Local-only `IndexMap`/`IndexSet` values that aren't stored in cells stay as they are. Verified with: - a workspace `cargo check --all-targets`; - clippy `-D warnings` on the touched crates; - the lib tests of turbo-bincode, turbo-tasks, turbopack-core, turbopack-ecmascript, turbopack-css and next-core; - the turbopack snapshot tests (25) and execution tests (444), with no snapshot changes. <!-- NEXT_JS_LLM --> <!-- fleet 14d61f44-d6a1-4adf-839c-9584f32828c2 --> Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading