-
Notifications
You must be signed in to change notification settings - Fork 30.4k
Turbopack: Define Effect as a trait instead of a closure
#89080
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
base: canary
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
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: **434 kB** → **434 kB** ✅ -11 B81 files with content-based hashes (individual files not comparable between builds) 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 (2 files)Files with changes:
View diffspages-api.runtime.dev.jsDiff too large to display pages.runtime.dev.jsDiff too large to display |
| /// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it allowed to execute a turbo-task?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
counterpoint is that we should align this with the file-io semaphore more? some small multiple of 4?
Tests Passed |

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.