kolint / next

Modern toolchain for enhancing usage of Knockout.js
https://kolint.github.io/next/
MIT License
1 stars 0 forks source link

Optimize usage of typescript compiler #18

Closed tscpp closed 3 months ago

tscpp commented 3 months ago

The legacy compiler is really slow because it creates multiple instances of the typescript compiler host and program for each file. The compiler package is still dependant on the legacy compiler to build the typescript source file. The legacy compiler needs to be optimized.

tscpp commented 3 months ago

This is the benchmarks from running a test multiple times. The first test is cold and the others are hot.

✓ Analyzer > Reports diagnostic 'TS2345' [696.37ms]
✓ Analyzer > Reports diagnostic 'TS2345' [418.74ms]
✓ Analyzer > Reports diagnostic 'TS2345' [366.30ms]
✓ Analyzer > Reports diagnostic 'TS2345' [375.33ms]
✓ Analyzer > Reports diagnostic 'TS2345' [337.32ms]
✓ Analyzer > Reports diagnostic 'TS2345' [334.73ms]
✓ Analyzer > Reports diagnostic 'TS2345' [332.34ms]
✓ Analyzer > Reports diagnostic 'TS2345' [330.94ms]
tscpp commented 3 months ago

A quick fix for this would be to make sure the legacy compiler can transpile multiple files at the same time.

https://github.com/kolint/next/blob/c189b2d783bf8414c599c8e25e16c166427e6dd8/packages/legacy-compiler/src/compiler/compiler.ts#L220-L224