Skip to content

[pull] canary from vercel:canary#1133

Merged
pull[bot] merged 3 commits into
code:canaryfrom
vercel:canary
Jun 16, 2026
Merged

[pull] canary from vercel:canary#1133
pull[bot] merged 3 commits into
code:canaryfrom
vercel:canary

Conversation

@pull

@pull pull Bot commented Jun 16, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

sampoder and others added 3 commits June 15, 2026 22:08
This is a follow-up PR to
#94297 (comment);
also adds an `append()` method to `BumpVec`.

---------

Co-authored-by: Benjamin Woodruff <benjamin.woodruff@vercel.com>
### What?

Shrink `RawVc` (16 → **8 bytes**) and `CellId` (6 → **4 bytes**), by
hand-packing them into `NonZero` integers.

### Why?

`RawVc` is the type-erased representation behind every `Vc` /
`ResolvedVc` / `OperationVc`, and `CellId` keys every task cell. They
live in huge numbers in the cache keys and task storage to track cells.
Cutting `RawVc` in half and `CellId` by a third removes hundreds of
megabytes of peak RSS on a real, large app.

### How?

| Type      | Before   | After    | Representation |
|-----------|----------|----------|----------------|
| `CellId` | 6 bytes | **4 bytes** | `NonZeroU32`: `ValueTypeId` in the
top 10 bits, cell index in the low 22 bits |
| `RawVc` | 16 bytes | **8 bytes** | `NonZeroU64`; bit 31 flags
`LocalOutput`, and the two task variants are split by whether the
high-32-bit `CellId` field is zero |


Supporting changes:

- **`TaskId` constrained to 31 bits**
- **`ValueTypeId` capped at 1023** (10 bits) and **cell index capped at
~4.19M** (22 bits), enforced at the registry and cell-allocation sites.

Together those restrictions enable us to preserve a bit to use as a
discreminent in RawVc and pack `CellId` into a u32

### Perf

Building vercel-site, 5 runs each. `maxRSS` and `user CPU` are means;
`wall` is the median
| Condition | Branch | maxRSS | wall (s) | user CPU (s) |
|---|---|---|---|---|
| No persistence | canary | 13.64 GiB | 41.56 | 305.64 |
| No persistence | **this PR** | **13.04 GiB** | 40.72 | 299.52 |
| | | **−4.4%** | −2.0% | −2.0% |
| Persistence | canary | 17.19 GiB | 55.20 | 466.54 |
| Persistence | **this PR** | **16.30 GiB** | 55.12 | 462.33 |
| | | **−5.2%** | −0.1% | −0.9% |


<!-- NEXT_JS_LLM_PR -->
@pull pull Bot locked and limited conversation to collaborators Jun 16, 2026
@pull pull Bot added the ⤵️ pull label Jun 16, 2026
@pull pull Bot merged commit 901c080 into code:canary Jun 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants