Skip to content

[pull] canary from vercel:canary#1097

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

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

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Jun 3, 2026

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 : )

lubieowoce and others added 3 commits June 3, 2026 13:43
In #93801, we'll be removing `getRuntimeStage` because we want to
differentiate session data and link data, which resolve in different
stages. `delayUntilRuntimeStage` isn't all that useful anyway (we can do
`stagedRendering.delayUntilStage` instead) and gets in the way of that
refactor. This should have no behavior changes otherwise.
### What?

In the `DiskFileSystem` `write` and `write_link` implementations
(`turbopack/crates/turbo-tasks-fs/src/lib.rs`), change the `full_path`
field on the `WriteEffect` and `WriteLinkEffect` structs from
`Arc<PathBuf>` to `Arc<Path>`.

### Why?

`Arc<PathBuf>` stores two heap allocations and an extra indirection: the
`Arc` allocation holds a `PathBuf` (`Vec<u8>`-like), which in turn
points to the actual path bytes. `Arc<Path>` is a thin/wide-pointer to a
single allocation containing the path bytes inline next to the `Arc`
header, which is both smaller (no separate `PathBuf` capacity field) and
removes one level of pointer chasing on every access.

These effects are cloned per write side-effect and live until the effect
is applied, so the saved allocation/indirection is a small but free win.

### How?

- Change the `full_path` field type on `WriteEffect` and
`WriteLinkEffect` from `Arc<PathBuf>` to `Arc<Path>`.
- Update the two construction sites from `Arc::new(full_path)` to
`Arc::from(full_path)`, which uses the standard library's `From<PathBuf>
for Arc<Path>` impl to move the path bytes directly into a single
`Arc<Path>` allocation.

No call sites needed updating: all existing uses
(`validate_path_length(&self.full_path)`,
`self.inner.invalidate_from_write(&self.full_path)`,
`self.full_path.as_os_str()`) already only need `&Path`, which is
reached via `Deref` from both `Arc<PathBuf>` and `Arc<Path>`.

Verified locally with `cargo check -p turbo-tasks-fs` and `cargo clippy
-p turbo-tasks-fs --all-targets`.

<!-- NEXT_JS_LLM_PR -->

Co-authored-by: v-work-app[bot] <262237222+v-work-app[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com>
…#94430)

Split out of #93801.

Adds a new config option to `StagedRenderingController` - `finalStage`.
Staged prerenders must indicate which stage they plan to abort after.

This lets us generalize the "wait for the runtime stage" bit in
`createHangingInputAbortSignal` to now mean "wait until the last stage
of the prerender". This will be used more in #93801, where
- we need to be able to abort a runtime prerender earlier than the
Runtime stage (only rendering a session shell, without link data),
meaning that we can't hardcode the stage there
- we add additional shell stages to static prerenders, meaning that we
must wait until the last stage (Static) until hanging inputs can be
aborted
@pull pull Bot locked and limited conversation to collaborators Jun 3, 2026
@pull pull Bot added the ⤵️ pull label Jun 3, 2026
@pull pull Bot merged commit 02953dc into code:canary Jun 3, 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.

2 participants