next.js
6890cef0 - Use fixed encoding for our 'id' types (#100764)

Commit
3 days ago
Use fixed encoding for our 'id' types (#100764) Varint encoding works well for things like lengths/indicies which are naturally 'zero biased' but many of our 'id' types are not like that Switch them to use a fixed encoding This includes: * `TaskId` mostly 5 bytes before, now 4 bytes always * `CellId` always 5 bytes before, now 4 bytes always * `RawVc` always 9 bytes before, 8 bytes now * `FunctionId` mostly 3 bytes before, now 2 bytes * `ValueTypeId` mostly 3 bytes before now 2 bytes * `TraitTypeId` transformed to a `NonZeroU8` so it always takes the fixed int encode path naturally In principle it is possible that we might still benefit from varint encoding if most of the uses of these ids were biased towards smaller values, but at least in practice this isn't the case. ### Results Measured on a large app comparing to canary | | canary | this PR | change | per-round range | |---|---|---|---|---| | **Cache size after cold build** | 2.646 GB | 2.546 GB | **−3.8%** | −3.8 to −3.7% | | **Cache size after warm build** (compacted) | 2.628 GB | 2.527 GB | **−3.8%** | −3.9 to −3.7% | | **Warm build user CPU** (mostly decoding) | 43.8s | 42.2s | **−3.7%** | −5.1 to −2.3% | | Cold build user CPU | 482.6s | 483.0s | +0.1% | −1.4 to +1.0% | | Wall time, cold / warm | 75.3s / 31.2s | 76.1s / 31.4s | within noise | | | Peak RSS, cold / warm | | | −0.2% / −0.8% | |
Author
Parents
Loading