Commit 1a499c5
bootstrap: optimize modules loaded in the built-in snapshot
Preload essential modules and lazy-load non-essential ones.
After this patch, all modules listed by running this snippet:
```
const list = process.moduleLoadList.join('\n');
require('fs').writeSync(1, list, 'utf-8');
```
(which is roughly the same list as the one in
test-bootstrap-module.js for the main thread)
are loaded from the snapshot so no additional compilation cost
is incurred.
PR-URL: #45849
Backport-PR-URL: #46425
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>1 parent e0e09ca commit 1a499c5
File tree
3 files changed
+38
-12
lines changed- lib/internal
- bootstrap/switches
- process
- test/parallel
3 files changed
+38
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
270 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
| |||
324 | 325 | | |
325 | 326 | | |
326 | 327 | | |
327 | | - | |
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
333 | 334 | | |
334 | 335 | | |
335 | 336 | | |
| |||
344 | 345 | | |
345 | 346 | | |
346 | 347 | | |
347 | | - | |
348 | | - | |
349 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
350 | 352 | | |
351 | 353 | | |
352 | 354 | | |
| |||
545 | 547 | | |
546 | 548 | | |
547 | 549 | | |
548 | | - | |
549 | | - | |
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
67 | | - | |
68 | 66 | | |
69 | 67 | | |
70 | 68 | | |
| |||
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
82 | | - | |
83 | 80 | | |
84 | 81 | | |
85 | 82 | | |
| |||
0 commit comments