[pull] canary from vercel:canary#1097
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 : )