You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[turbopack] Remove the turbo_tasks::function attributes from a number of tasks that do not get cache hits. (#83241)
Drop `turbo_tasks::function` annotation from functions that never get cache hits.
We only do this in cases where:
* there are no cache hits in production or dev builds
* There is a structural reason for it. Typically, because that task is 'dominated' by another one.
* Or, the task being cached is so small that we shouldn't worry about even theoretical hits.
Tasks being modified or removed (numbers are from a vercel-site build):
* `turbopack-ecmascript::parse::parse` (63398 tasks)
- this task gets no hits due to a few 'dominating' tasks. In this case we remove turbotasks::function from `EcmascriptModuleAsset::parse`, since there are some theoretical hits.
* `EcmascriptChunkItemContent::module_factory` (55804 tasks)
- This function is completely 'dominated' by `module_factory_with_code_generation_issue` so we don't need it, even in a PC environment we should expect this to be the case
* `Module::style_type` (63237 tasks, though we don't save all of them)
* Only gets called once for each module so there were no cache hits. However, it is useful for HMR and PC to ensure we don't recompute style groups. So move this to a new trait and call it conditionally which eliminates all overhead while preseving cacheability
* `track_glob` (11432 tasks)
* this is used to set up dependencies on files read by webpack loaders. This was made conditional on whether or not any dependencies are being tracked. at all
* `apply_module_type` (152887 tasks) and `apply_reexport_treeshaking` (57527 tasks):
- both of these are dominated by other tasks
* `EcmascriptAnalyzable::module_content` (40310 tasks)
- This one is trivially dominated and really just plugs two other Vcs together, so i dropped `turbo_tasks::function`, as default trait method this actually required a new feature in the macro gencode.
So altogether this eliminates about 4.97% (444595/8939581) tasks from a build of vercel-site.
From measuring the builds I also see a progression

Which is (@p50) 1.7 seconds faster (-2.6%) and uses 290 MB less memory (-2%). The micro benchmarks show bigger progressions, but that makes sense, they are more sensitive to overheads.
0 commit comments