next.js
ee3a50cc - Upgrade Turbopack to hashbrown 0.15 (#97808)

Commit
2 days ago
Upgrade Turbopack to hashbrown 0.15 (#97808) ### What? Upgrade Turbopack's workspace dependencies to DashMap 7.0.0-rc2 and Hashbrown 0.15.4, removing Hashbrown 0.14 from the `turbo-tasks-backend` dependency graph. ### Why? `turbo-tasks-backend` previously compiled two Hashbrown versions because its custom DashMap helpers shared Hashbrown 0.14's private raw table types. Converging the backend graph on Hashbrown 0.15 removes that duplicate backend codegen path and slightly reduces the shipped native addon's size. A clean release A/B of the unstripped x86-64 `next-napi-bindings` cdylib measured: | Revision | `libnext_napi_bindings.so` | | --- | ---: | | canary base `80576037` | 147,824,920 bytes | | PR | 147,818,576 bytes | | **Delta** | **−6,344 bytes (−0.0043%)** | The final gain is small because unrelated SWC dependencies still pull DashMap 6 / Hashbrown 0.14 into the same addon; this change removes only backend-specific Hashbrown 0.14 codegen. Plus... nearly everything is monomorphized anyway ### How? DashMap 7 replaces its Hashbrown 0.14 raw table with Hashbrown 0.15's public `HashTable` API. The backend helpers now use that public API while retaining their existing shard locking and allocation behavior: - heterogeneous cache lookup and insertion still reuse a pre-located shard and precomputed hash; - the entry helper passes Hashbrown's native `hash_table::Entry` into a closure, preserving precise lock-release timing without a custom self-referential entry type or cloned hasher; - nonblocking removal still avoids lock-order deadlocks; - two-key mutation uses a release-mode disjointness assertion followed by `get_many_unchecked_mut` to avoid a redundant duplicate-pointer scan; - snapshot draining still transfers ownership of each shard table and releases task memory incrementally; - custom mutable guards remain non-`Send`. The migration also replaces several raw-pointer iteration and removal paths with safe `HashTable` operations. Existing raw-entry users in `auto-hash-map` and `turbopack-trace-server` explicitly enable Hashbrown 0.15's compatibility feature. ### Performance Performance testing with the overhead.rs benchmark revealed no regression/progression <!-- NEXT_JS_LLM --> <!-- fleet 53ff0bed-46a9-4361-befa-a1791d585f27 --> --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
Author
Parents
Loading