next.js
95e92c73 - [turbopack] const-ify most of the registration code (#90868)

Commit
45 days ago
[turbopack] const-ify most of the registration code (#90868) # What Make a significant chunk of the remaining turbotask registration code (Values, Traits and Value/Trait impls) `const`. The vtable lookup for trait methods is constructed at compile time, allowing us to look up a trait's implementation in near-constant time. Introduces a new, common RegistryType we use for Values, Traits and Functions to reduce duplication. We still have a Lazy guard on each registry, but that will probably be removed if we migrate to distributed slices. NOTE: This removes a number of Lazy guards, but not all of them to avoid making the PR too large. The next pass of PR will remove the remaining Lazy guards, where possible. # Why By making this code `const`, we reduce the overall init time of the executable, make LTO a little more powerful (when we end up using that), reduce startup allocations, and reduce the amount of time we spend checking Lazy atomics. In hyperfine tests of the benchmark-apps folder, we see a 1% to 3% speedup for compilation.
Author
Parents
Loading