Commit 6b89fe9
authored
Turbopack: use prototype for turbopack context for better runtime performance (#81547)
### What?
* use prototype for turbopack context for better runtime performance
* remove destructuring when unneeded
* ensure all calls use the correct context
* create static module object at one location
### Why?
Improve performance by reducing allocations in the hot path of module evaluation:
Based on our module-cost benchmark this is about a 15% runtime improvement
* CommonJS Execution Duration: 25.60ms → 21.85ms (14.6% improvement)
* ESM Execution Duration: 53.34ms → 44.82ms (16.0% improvement)
Which addressed most of the known gap with webpack.
Part of PACK-50571 parent 76200c7 commit 6b89fe9
File tree
57 files changed
+918
-873
lines changed- crates/next-core/src/next_app
- packages/next/src/client
- test/development/acceptance-app
- turbopack/crates
- turbopack-ecmascript-runtime/js/src
- browser/runtime
- base
- dom
- edge
- nodejs
- turbopack-ecmascript/src
- chunk
- references
- side_effect_optimization
- facade
- locals
- transform
- tree_shake
- turbopack-tests/tests/snapshot
- basic-tree-shake/dynamic-import/output
- basic
- async_chunk_build/output
- async_chunk/output
- top-level-await/output
- comptime/typeof/output
- css
- css-modules/output
- css/output
- cycle2/output
- cycle/output
- embed-url/output
- imports
- dynamic/output
- ignore-comments/output
- static-and-dynamic/output
- runtime
- default_build_runtime/output
- default_dev_runtime/output
- turbopack-wasm/src
- turbopack/src/module_options
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
57 files changed
+918
-873
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
| 101 | + | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
289 | 293 | | |
290 | 294 | | |
291 | 295 | | |
| |||
298 | 302 | | |
299 | 303 | | |
300 | 304 | | |
301 | | - | |
| 305 | + | |
302 | 306 | | |
303 | 307 | | |
304 | 308 | | |
| |||
Lines changed: 19 additions & 72 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 55 | + | |
76 | 56 | | |
77 | 57 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 58 | + | |
102 | 59 | | |
103 | 60 | | |
104 | 61 | | |
105 | 62 | | |
106 | 63 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 64 | + | |
| 65 | + | |
133 | 66 | | |
134 | 67 | | |
135 | 68 | | |
| |||
143 | 76 | | |
144 | 77 | | |
145 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
0 commit comments