Repository navigation
Commit 619d978
authored
perf(performance): ask each chunk once what is loaded where it runs (#21779)
`getLoadedChunks` depends on its chunk alone, and was walked again for every
module in it — on a hub chunk 30 entrypoints reach, 330 walks where 31 answer
the question. Memoized per chunk in the hook that builds it, so the map goes
with it rather than outliving the seal.
Bounded work, not a build-time win: the hook is well under 1% of the build, and
where every module holding an `import()` has a chunk of its own the map never
pays. It earns its keep only on a shared chunk (4.79ms -> 1.40ms on that
fixture, medians of 9 interleaved builds, spreads apart).1 parent 4b389bc commit 619d978
1 file changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
120 | 140 | | |
121 | 141 | | |
122 | 142 | | |
| |||
0 commit comments