Tobias KoppersGitHubv-work-app[bot] <262237222+v-work-app[bot]@users.noreply.github.com>ClaudeTobias Koppers
97565d1592 DiskFileSystem: store Effect full_path as Arc<Path> (#94332)
### 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 <[email protected]>
Co-authored-by: Tobias Koppers <[email protected]>
2026-06-03 17:24:04 +02:00
…
…
…
…
2026-06-03 08:15:31 +00:00
2026-06-03 08:15:31 +00:00
…

Next.js logo

Next.js

Vercel logo NPM version License Join the community on GitHub

Getting Started

Used by some of the world's largest companies, Next.js enables you to create full-stack web applications by extending the latest React features, and integrating powerful Rust-based JavaScript tooling for the fastest builds.

Documentation

Visit https://nextjs.org/docs to view the full documentation.

Community

The Next.js community can be found on GitHub Discussions where you can ask questions, voice ideas, and share your projects with other people.

To chat with other community members you can join the Next.js Discord server.

Do note that our Code of Conduct applies to all Next.js community channels. Users are highly encouraged to read and adhere to it to avoid repercussions.

Contributing

Contributions to Next.js are welcome and highly appreciated. However, before you jump right into it, we would like you to review our Contribution Guidelines to make sure you have a smooth experience contributing to Next.js.

Good First Issues:

We have a list of good first issues that contain bugs that have a relatively limited scope. This is a great place for newcomers and beginners alike to get started, gain experience, and get familiar with our contribution process.


Security

If you believe you have found a security vulnerability in Next.js, we encourage you to responsibly disclose this and NOT open a public issue.

To participate in our Open Source Software Bug Bounty program, please email [email protected]. We will add you to the program and provide further instructions for submitting your report.

S
Description
The React Framework
Readme
2.4 GiB
Languages
JavaScript 55.6%
TypeScript 30%
Rust 12.9%
MDX 0.7%
CSS 0.7%