This package has been deprecated
This is old, don't use it
TypeScript compiler daemon/service
This is a simple service that loads the TypeScript compiler and runs it on incoming request data. This provides a performance benefit compared to repeated invocations of "tsc" from the command line, because the TypeScript compiler source code does not need to be reparsed and JIT optimizations are more likely to be used, especially on subsequent compiles.
The service is intended to be used for local development only (see Limitations).
Informal benchmarks show up to 30% increase in compiled speed vs normal command line invocation, once the service is "warmed up". Comparison with tsc:
new-host:client john$ time tsc Main.ts real 0m2.472s user 0m2.388s sys 0m0.096s new-host:client john$ time tsc Main.ts real 0m2.455s user 0m2.370s sys 0m0.091s new-host:client john$ time tsc Main.ts real 0m2.436s user 0m2.356s sys 0m0.094s new-host:client john$ time ~/Dev/TypeScript/tscd/tscdc Main.ts real 0m2.265s user 0m0.164s sys 0m0.022s new-host:client john$ time ~/Dev/TypeScript/tscd/tscdc Main.ts real 0m1.845s user 0m0.165s sys 0m0.023s new-host:client john$ time ~/Dev/TypeScript/tscd/tscdc Main.ts real 0m1.635s user 0m0.162s sys 0m0.022s
Clone this repo (no npm package yet), then
npm install # start service ./tcsd
Then, run the client with the tscdc command. This command accepts the same parameters as tsc, so it can be used as a drop in replacement for tsc.
- Windows is untested. In particular, there are some symlinks set at the top level of the repro which are required to compile code.
- If you send the service too many requests at the same time, the node workers (default 8) may all become busy; the results will likely be slower than just running tsc directly.
- The service includes a 500ms compilation "debounce filter". If a client requests compilation of the same inputs less than 500ms after the previous one was completed, the service just returns the previous result. This is to speed up IDEs like Webstorm 7, which has a bug that cause it to perform redundant compilations.