-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Move the typecast out of ReadRawVcFuture and into a new wrapper type #8654
Merged
Conversation
This file contains 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
- Fixed lots of links. - Export `VcCast`, `VcValueTypeCast`, and `VcValueTraitCast`, as they're used in some type signatures, and some documentation is impossible to follow without it. This introduces the sealed trait pattern to `VcCast` to continue to strongly prevent foreign implementations.
I noticed we were doing the typecast inside `ReadRawVcFuture`. This felt bad for a few reasons: - It's confusing that `IntoFuture` for `Vc` exposes a "raw" type to userspace. `RawVc` is a concept that only turbo-tasks internals and backends should deal with. - `RawVc` is the type-erased version of `Vc`, so it's wrong for it to do the cast. `Vc` should do the cast. - `ReadRawVcFuture` has a large `poll` method, so it would be ideal to avoid monomorphizing that (this seems to be a huge advantage of `RawVc`!), but unfortunately since this does a cast, it must be monomorphized. This moves the casting logic and type annotations into a new `ReadVcFuture` type that wraps `ReadRawVcFuture`.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
9 Skipped Deployments
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Logs
See job summary for details |
🟢 Turbopack Benchmark CI successful 🟢Thanks |
|
kdy1
approved these changes
Jul 3, 2024
sokra
approved these changes
Jul 3, 2024
ForsakenHarmony
pushed a commit
to vercel/next.js
that referenced
this pull request
Jul 25, 2024
…ercel/turborepo#8654) ## Description I noticed we were doing the typecast inside `ReadRawVcFuture`. This felt bad for a few reasons: - It's confusing that `IntoFuture` for `Vc` exposes a "raw" type to userspace. `RawVc` is a concept that only turbo-tasks internals and backends should deal with. - `RawVc` is the type-erased version of `Vc`, so it's wrong for it to do the cast. `Vc` should do the cast. - `ReadRawVcFuture` has a large `poll` method and many different values for `T`, so it would be ideal to avoid monomorphizing that (this seems to be a huge advantage of `RawVc`!), but unfortunately since this did a cast, it was being monomorphized. This moves the casting logic and type annotations into a new `ReadVcFuture` type that wraps `ReadRawVcFuture`. ## Binary Size *This is an easy-to-measure proxy metric for rustc build times. As monomorphization happens in crates that use these methods, and not those that define them, it may have an increased impact on incremental build times.* I built `next-swc` tarballs on Linux arm64. Comparing stripped debug builds created with `pnpm pack-next` gives a 660KB or 0.3958% decrease: ``` -rw-r--r-- 1 bgw bgw 170752000 Jul 2 16:28 next-swc.before.tar -rw-r--r-- 1 bgw bgw 170076160 Jul 2 16:18 next-swc.after.tar ``` Comparing stripped release builds created with `pnpm pack-next --release` gives a 320KB or 0.3049% decrease: ``` -rw-r--r-- 1 bgw bgw 107130880 Jul 2 16:43 next-swc.after.tar -rw-r--r-- 1 bgw bgw 107458560 Jul 2 16:40 next-swc.before.tar ```
ForsakenHarmony
pushed a commit
to vercel/next.js
that referenced
this pull request
Jul 29, 2024
…ercel/turborepo#8654) ## Description I noticed we were doing the typecast inside `ReadRawVcFuture`. This felt bad for a few reasons: - It's confusing that `IntoFuture` for `Vc` exposes a "raw" type to userspace. `RawVc` is a concept that only turbo-tasks internals and backends should deal with. - `RawVc` is the type-erased version of `Vc`, so it's wrong for it to do the cast. `Vc` should do the cast. - `ReadRawVcFuture` has a large `poll` method and many different values for `T`, so it would be ideal to avoid monomorphizing that (this seems to be a huge advantage of `RawVc`!), but unfortunately since this did a cast, it was being monomorphized. This moves the casting logic and type annotations into a new `ReadVcFuture` type that wraps `ReadRawVcFuture`. ## Binary Size *This is an easy-to-measure proxy metric for rustc build times. As monomorphization happens in crates that use these methods, and not those that define them, it may have an increased impact on incremental build times.* I built `next-swc` tarballs on Linux arm64. Comparing stripped debug builds created with `pnpm pack-next` gives a 660KB or 0.3958% decrease: ``` -rw-r--r-- 1 bgw bgw 170752000 Jul 2 16:28 next-swc.before.tar -rw-r--r-- 1 bgw bgw 170076160 Jul 2 16:18 next-swc.after.tar ``` Comparing stripped release builds created with `pnpm pack-next --release` gives a 320KB or 0.3049% decrease: ``` -rw-r--r-- 1 bgw bgw 107130880 Jul 2 16:43 next-swc.after.tar -rw-r--r-- 1 bgw bgw 107458560 Jul 2 16:40 next-swc.before.tar ```
ForsakenHarmony
pushed a commit
to vercel/next.js
that referenced
this pull request
Jul 29, 2024
…ercel/turborepo#8654) ## Description I noticed we were doing the typecast inside `ReadRawVcFuture`. This felt bad for a few reasons: - It's confusing that `IntoFuture` for `Vc` exposes a "raw" type to userspace. `RawVc` is a concept that only turbo-tasks internals and backends should deal with. - `RawVc` is the type-erased version of `Vc`, so it's wrong for it to do the cast. `Vc` should do the cast. - `ReadRawVcFuture` has a large `poll` method and many different values for `T`, so it would be ideal to avoid monomorphizing that (this seems to be a huge advantage of `RawVc`!), but unfortunately since this did a cast, it was being monomorphized. This moves the casting logic and type annotations into a new `ReadVcFuture` type that wraps `ReadRawVcFuture`. ## Binary Size *This is an easy-to-measure proxy metric for rustc build times. As monomorphization happens in crates that use these methods, and not those that define them, it may have an increased impact on incremental build times.* I built `next-swc` tarballs on Linux arm64. Comparing stripped debug builds created with `pnpm pack-next` gives a 660KB or 0.3958% decrease: ``` -rw-r--r-- 1 bgw bgw 170752000 Jul 2 16:28 next-swc.before.tar -rw-r--r-- 1 bgw bgw 170076160 Jul 2 16:18 next-swc.after.tar ``` Comparing stripped release builds created with `pnpm pack-next --release` gives a 320KB or 0.3049% decrease: ``` -rw-r--r-- 1 bgw bgw 107130880 Jul 2 16:43 next-swc.after.tar -rw-r--r-- 1 bgw bgw 107458560 Jul 2 16:40 next-swc.before.tar ```
ForsakenHarmony
pushed a commit
to vercel/next.js
that referenced
this pull request
Aug 1, 2024
…ercel/turborepo#8654) ## Description I noticed we were doing the typecast inside `ReadRawVcFuture`. This felt bad for a few reasons: - It's confusing that `IntoFuture` for `Vc` exposes a "raw" type to userspace. `RawVc` is a concept that only turbo-tasks internals and backends should deal with. - `RawVc` is the type-erased version of `Vc`, so it's wrong for it to do the cast. `Vc` should do the cast. - `ReadRawVcFuture` has a large `poll` method and many different values for `T`, so it would be ideal to avoid monomorphizing that (this seems to be a huge advantage of `RawVc`!), but unfortunately since this did a cast, it was being monomorphized. This moves the casting logic and type annotations into a new `ReadVcFuture` type that wraps `ReadRawVcFuture`. ## Binary Size *This is an easy-to-measure proxy metric for rustc build times. As monomorphization happens in crates that use these methods, and not those that define them, it may have an increased impact on incremental build times.* I built `next-swc` tarballs on Linux arm64. Comparing stripped debug builds created with `pnpm pack-next` gives a 660KB or 0.3958% decrease: ``` -rw-r--r-- 1 bgw bgw 170752000 Jul 2 16:28 next-swc.before.tar -rw-r--r-- 1 bgw bgw 170076160 Jul 2 16:18 next-swc.after.tar ``` Comparing stripped release builds created with `pnpm pack-next --release` gives a 320KB or 0.3049% decrease: ``` -rw-r--r-- 1 bgw bgw 107130880 Jul 2 16:43 next-swc.after.tar -rw-r--r-- 1 bgw bgw 107458560 Jul 2 16:40 next-swc.before.tar ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
I noticed we were doing the typecast inside
ReadRawVcFuture
. This felt bad for a few reasons:It's confusing that
IntoFuture
forVc
exposes a "raw" type to userspace.RawVc
is a concept that only turbo-tasks internals and backends should deal with.RawVc
is the type-erased version ofVc
, so it's wrong for it to do the cast.Vc
should do the cast.ReadRawVcFuture
has a largepoll
method and many different values forT
, so it would be ideal to avoid monomorphizing that (this seems to be a huge advantage ofRawVc
!), but unfortunately since this did a cast, it was being monomorphized.This moves the casting logic and type annotations into a new
ReadVcFuture
type that wrapsReadRawVcFuture
.Binary Size
This is an easy-to-measure proxy metric for rustc build times. As monomorphization happens in crates that use these methods, and not those that define them, it may have an increased impact on incremental build times.
I built
next-swc
tarballs on Linux arm64.Comparing stripped debug builds created with
pnpm pack-next
gives a 660KB or 0.3958% decrease:Comparing stripped release builds created with
pnpm pack-next --release
gives a 320KB or 0.3049% decrease: