Commit d31ff5e
committed
perf(@angular/build): decouple diagnostic type checking from build start
Previously, the compiler plugin sequentially awaited compilation.diagnoseFiles() in build.onStart before returning to esbuild.
Because build.onStart blocked until TypeScript diagnostic checks finished, esbuild's Go bundler sat idle while single-threaded type checking occurred, preventing module resolution and bundling from running concurrently.
To overlap bundling with type checking:
- Initiate compilation.diagnoseFiles() asynchronously during build.onStart without awaiting its completion.
- Allow build.onStart to return immediately once compilation emit is complete, enabling esbuild to begin bundling and file resolution concurrently.
- Await the diagnostics promise in build.onEnd, merging any diagnostic errors or warnings into the final build result.
In benchmarks on clean builds, this overlaps diagnostic checks with bundling, saving ~150 ms in small projects and 500 ms to 2,000+ ms in large enterprise codebases.1 parent 6b20983 commit d31ff5e
1 file changed
Lines changed: 20 additions & 10 deletions
Lines changed: 20 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
402 | 403 | | |
403 | 404 | | |
404 | 405 | | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
414 | 410 | | |
415 | 411 | | |
416 | 412 | | |
| |||
617 | 613 | | |
618 | 614 | | |
619 | 615 | | |
620 | | - | |
| 616 | + | |
621 | 617 | | |
622 | 618 | | |
623 | 619 | | |
| |||
640 | 636 | | |
641 | 637 | | |
642 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
643 | 653 | | |
644 | 654 | | |
645 | 655 | | |
| |||
0 commit comments