next.js
08531ea6 - turbo-tasks: mimalloc-aware grow/shrink for LazyTail

Commit
58 days ago
turbo-tasks: mimalloc-aware grow/shrink for LazyTail mimalloc rounds allocation requests up to bin boundaries — asking for 65 B reserves the 80 B bin, so the next push up to 80 B is free. Two new behaviors: - `TurboMalloc::good_size(n)`: thin wrapper over `mi_good_size` (falls back to `next_power_of_two().max(16)` when `custom_allocator` is off). - `LazyTail::grow_to` allocates `good_size(min_bytes)` instead of the previous power-of-two doubling. Each grow now reserves exactly the bin it would have ended up in anyway, eliminating the second realloc that used to fire when an earlier push left the buffer just below the bin boundary. - `LazyTail::shrink_to_fit` is bin-aware: it only reallocates when `good_size(len) < good_size(cap)`. Within a bin the realloc is free but pointless, so we skip it. 50 backend tests pass; whole workspace builds.
Author
Committer
Parents
Loading