-
Notifications
You must be signed in to change notification settings - Fork 30k
Turbopack: bincode: Implement bincode Encode/Decode traits on all turbo task values #85580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
This was referenced Oct 30, 2025
Merged
Member
Author
5d855c0 to
da8d4c4
Compare
999a952 to
f7ce13a
Compare
da8d4c4 to
7f3d072
Compare
f7ce13a to
77a6a79
Compare
7f3d072 to
dc20107
Compare
77a6a79 to
295ca2d
Compare
This was referenced Nov 5, 2025
295ca2d to
f3589ab
Compare
0928c7e to
52f0b9c
Compare
68e86b2 to
26bb161
Compare
52f0b9c to
0928c7e
Compare
mischnic
reviewed
Nov 5, 2025
439db5f to
ad15366
Compare
26bb161 to
b6273ac
Compare
ad15366 to
f7b4a8f
Compare
b6273ac to
369f98d
Compare
8e994ab to
a2afb2d
Compare
This was referenced Nov 29, 2025
117cba5 to
c17d228
Compare
a2afb2d to
06d12f7
Compare
06d12f7 to
6198395
Compare
c17d228 to
c60ce3d
Compare
6198395 to
5ccd5fb
Compare
sokra
approved these changes
Dec 3, 2025
c60ce3d to
deda71f
Compare
deda71f to
dfc51d0
Compare
5ccd5fb to
97031f9
Compare
97031f9 to
9b32348
Compare
9b32348 to
d56832e
Compare
Member
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CI Bypass Graphite Optimization
Ignore Graphite CI optimizations, run the full CI suite. https://graphite.dev/docs/stacking-and-ci
created-by: Turbopack team
PRs by the Turbopack team.
Font (next/font)
Related to Next.js Font Optimization.
Turbopack
Related to Turbopack with Next.js.
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.

It looks like bincode should reduce the filesystem cache size by ~10% versus pot, because its not a self-describing format. This attempts to add the
bincode::Encode/bincode::Decodetraits everywhere, so that we can use those instead of serde.Why not use bincode's serde compatibility feature?
bincode's traits avoid this by not exposing features that would be incompatible with a self-describing format. https://docs.rs/bincode/latest/bincode/serde/index.html#known-issuesbincode::Encode/Decodeare much simpler traits than serde's equivalents, so we'll probably get some rustc build performance and turbopack binary size benefits from using the bincode versions. In cases where we do have to implement these traits by hand, it's much easier than implementing the serde equivalents.erased-serdeanyways because we're probably paying some performance cost from the large amounts of dynamic dispatch it performs, and we're not getting any benefits from it if we only ever serialize to a single format.Forks of Upstream Crates
bincodehere: https://github.com/bgw/bincode/commits/bgw/patches/PhantomData.PhantomDataaren't very important, and we could work around it in our code.virtuehere: bgw/virtue@e386f35virtuehere: Fix parsing of defaults in generics bincode-org/virtue#94Other Notes
bincodeandvirtuecrates to fix a few bugs and add a few new features. I'll work on upstreaming these changes.BorrowDecodeeverywhere because thebincode::Decodederive macro requires it. I plan to add an attribute in my bincode fork to allow disabling this, and then we can get rid of all of theBorrowDecodeimpls. We don't want/needBorrowDecodefor turbo task values because everything needs to be owned anyways.