Turbopack: Define Effect as a trait instead of a closure#89080
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merging this PR will improve performance by 4.57%
Performance Changes
Comparing Footnotes
|
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📝 Changed Files (6 files)Files with changes:
View diffspages-api-tu..ntime.dev.jsDiff too large to display pages-api-tu..time.prod.jsDiff too large to display pages-api.ru..time.prod.jsDiff too large to display pages-turbo...ntime.dev.jsDiff too large to display pages-turbo...time.prod.jsDiff too large to display pages.runtime.prod.jsDiff too large to display 📎 Tarball URL |
| /// has "settled". | ||
| /// | ||
| /// The effect can store [`ResolvedVc`]s (or any other `Vc` type), and this can return values | ||
| /// containing those [`ResolvedVc`]s, but it should not read or resolve the contents of a `Vc`. |
There was a problem hiding this comment.
is it allowed to execute a turbo-task?
There was a problem hiding this comment.
No. After reading through this code, it appears to be accurate to simply say something like:
> This function is executed outside of the turbo-tasks context, and therefore cannot read any Vcs or call any turbo-task functions.
I'll update the comment for clarity.
| util::SharedError, | ||
| }; | ||
|
|
||
| const APPLY_EFFECTS_CONCURRENCY_LIMIT: usize = 1024; |
There was a problem hiding this comment.
if ~all effects are performing file IO.... which internally uses a semaphore should we bother with this extra limit?
There was a problem hiding this comment.
counterpoint is that we should align this with the file-io semaphore more? some small multiple of 4?
Tests Passed |
b7bb365 to
0a0ee57
Compare

This switches effects (special
Collectibles used to defer file writes) from using a closure representation to using a trait representation.This makes constructing effects a little more annoying, but it ensures that we'll be able to correctly implement
TraceRawVcson these in a subsequent PR.Changes to
turbo-tasks/src/effect.rswere done by hand, an LLM was used for updating the two callsites.