Skip to content

Compiler API (language service) becomes incredibly slow when noEmitOnError = true #24444

Closed
@AlCalzone

Description

@AlCalzone

TypeScript Version: 3.0.0-dev.20180526

Search Terms: compiler api noEmitOnError

I'm building an in-memory version of the TypeScript compiler using the language service API. This allows to compile and generate declarations for files that never reach the hard disk. While debugging another issue, I found that setting noEmitOnError to true drastically increases compile times with minor changes to the compiled sources.
I'm not 100% sure that the problem doesn't come from me misusing the API, so forgive me if this is actually not an issue in TypeScript.

Code
This is too much for a short repro, so I created a repro repo here:
https://github.com/AlCalzone/virtual-tsc/tree/ts-repro
To reproduce, npm install and then npm test. The project will run a few simple compilations using the language service API. It contains two identical test cases, where one has noEmitOnError = true and the other one false.

Both test cases correctly compile correct code and both catch syntax errors.

Expected behavior:
Similar results for both.

Actual behavior:

  compiler API repro =>
    √ noEmitOnError = false (2265ms)
    √ noEmitOnError = true (13794ms)
  2 passing (16s)

Related Issues: none found

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions