mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What? Use amortized shrinking. Capacity should always be a power of 2. We shrink when len is capacity / 3. Assuming the capacity was `2^x` we shrink to `2^(x-1)` which is `capacity / 2`. Therefore capacity is still larger than len, which avoids direct reallocation when items are added again.