turbo
e1693408 - Move the typecast out of ReadRawVcFuture and into a new wrapper type (#8654)

Commit
2 years ago
Move the typecast out of ReadRawVcFuture and into a new wrapper type (#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 ```
Author
bgw bgw
Parents
Loading