Commit 58d2dad
module: integrate TypeScript into compile cache
This integrates TypeScript into the compile cache by caching
the transpilation (either type-stripping or transforming) output
in addition to the V8 code cache that's generated from the
transpilation output.
Locally this speeds up loading with type stripping of
`benchmark/fixtures/strip-types-benchmark.ts` by ~65% and
loading with type transforms of
`fixtures/transform-types-benchmark.ts` by ~128%.
When comparing loading .ts and loading pre-transpiled .js on-disk
with the compile cache enabled, previously .ts loaded 46% slower
with type-stripping and 66% slower with transforms compared to
loading .js files directly.
After this patch, .ts loads 12% slower with type-stripping and
22% slower with transforms compared to .js.
(Note that the numbers are based on microbenchmark fixtures and
do not necessarily represent real-world workloads, though with
bigger real-world files, the speed up should be more significant).
PR-URL: #56629
Fixes: #54741
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent a62345e commit 58d2dadCopy full SHA for 58d2dad
File tree
Expand file treeCollapse file tree
9 files changed
+846
-16
lines changedOpen diff view settings
Filter options
- lib/internal/modules
- src
- test/parallel
Expand file treeCollapse file tree
9 files changed
+846
-16
lines changedOpen diff view settings
Collapse file
lib/internal/modules/typescript.js
Copy file name to clipboardExpand all lines: lib/internal/modules/typescript.js+59-4Lines changed: 59 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
22 | 22 | |
23 | 23 | |
24 | 24 | |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
25 | 30 | |
26 | 31 | |
27 | 32 | |
| ||
105 | 110 | |
106 | 111 | |
107 | 112 | |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
108 | 121 | |
109 | 122 | |
110 | 123 | |
111 | 124 | |
112 | | - |
| 125 | + |
113 | 126 | |
114 | 127 | |
115 | 128 | |
| ||
126 | 139 | |
127 | 140 | |
128 | 141 | |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
129 | 156 | |
130 | 157 | |
131 | 158 | |
| ||
142 | 169 | |
143 | 170 | |
144 | 171 | |
| 172 | + |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + |
145 | 190 | |
146 | | - |
147 | | - |
| 191 | + |
| 192 | + |
148 | 193 | |
149 | 194 | |
150 | | - |
| 195 | + |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
151 | 206 | |
152 | 207 | |
153 | 208 | |
|
Collapse file
+56-9Lines changed: 56 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
77 | 77 | |
78 | 78 | |
79 | 79 | |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
80 | 97 | |
81 | 98 | |
82 | 99 | |
83 | | - |
| 100 | + |
84 | 101 | |
85 | 102 | |
86 | 103 | |
| ||
256 | 273 | |
257 | 274 | |
258 | 275 | |
259 | | - |
| 276 | + |
| 277 | + |
260 | 278 | |
261 | 279 | |
262 | 280 | |
| ||
287 | 305 | |
288 | 306 | |
289 | 307 | |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
| 315 | + |
| 316 | + |
| 317 | + |
| 318 | + |
| 319 | + |
| 320 | + |
| 321 | + |
| 322 | + |
| 323 | + |
| 324 | + |
| 325 | + |
| 326 | + |
290 | 327 | |
291 | 328 | |
292 | 329 | |
| ||
316 | 353 | |
317 | 354 | |
318 | 355 | |
| 356 | + |
319 | 357 | |
320 | | - |
| 358 | + |
| 359 | + |
| 360 | + |
321 | 361 | |
322 | 362 | |
323 | 363 | |
324 | 364 | |
325 | | - |
326 | | - |
| 365 | + |
| 366 | + |
| 367 | + |
| 368 | + |
327 | 369 | |
328 | 370 | |
329 | 371 | |
330 | | - |
| 372 | + |
| 373 | + |
| 374 | + |
331 | 375 | |
332 | 376 | |
333 | 377 | |
| ||
363 | 407 | |
364 | 408 | |
365 | 409 | |
366 | | - |
367 | | - |
| 410 | + |
| 411 | + |
| 412 | + |
368 | 413 | |
369 | 414 | |
370 | 415 | |
371 | 416 | |
372 | 417 | |
373 | 418 | |
374 | 419 | |
375 | | - |
| 420 | + |
| 421 | + |
376 | 422 | |
| 423 | + |
377 | 424 | |
378 | 425 | |
379 | 426 | |
|
Collapse file
+12-3Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
13 | 13 | |
14 | 14 | |
15 | 15 | |
16 | | - |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
17 | 23 | |
18 | | - |
19 | | - |
| 24 | + |
| 25 | + |
| 26 | + |
20 | 27 | |
21 | 28 | |
22 | 29 | |
| ||
34 | 41 | |
35 | 42 | |
36 | 43 | |
| 44 | + |
37 | 45 | |
38 | 46 | |
39 | 47 | |
| ||
70 | 78 | |
71 | 79 | |
72 | 80 | |
| 81 | + |
73 | 82 | |
74 | 83 | |
75 | 84 | |
|
0 commit comments