-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Program created with createSemanticDiagnosticsBuilderProgram writes files to disk. #29176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The default // Between `createEmitAndSemanticDiagnosticsBuilderProgram` and
// `createSemanticDiagnosticsBuilderProgram`, the only difference is emit.
// For pure type-checking scenarios, or when another tool/process handles emit,
// using `createSemanticDiagnosticsBuilderProgram` may be more desirable. |
Unfortunately, it seems that there is a performance-related issue linked to emitting. I tried to copy emitFilesAndReportErrors function from watch.ts and simply remove writing and I immediately had performance drop. |
The |
@sheetalkamat, I have spent some time debugging the performance-related part of the issue and found a difference in this method. For SemanticDiagnosticsBuilderProgram this method goes into emit method from program.ts, which ends up checking ALL files of the project, instead of only checking the modified ones. Is it necessary to have different behavior in this method between EmitAndSemanticDiagnosticsBuilderProgram and SemanticDiagnosticsBuilderProgram ? |
@0xorial This is on purpose. Please see https://github.com/microsoft/TypeScript/blob/master/lib/typescript.d.ts#L4376 to see how the emit works.
Emit is optimized only for |
Sorry, I still do not understand - what is the purpose of not giving a performance optimization to SemanticDiagnosticsBuilderProgram ? It would work much faster this way, right? BTW, the reason I dig into this so persistently is because I was working on a webpack integration and I believe this is the fastest integration there is, with performance similar to running |
@0xorial I am not sure what you are asking. If you need performant emit then use |
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow. |
Search Terms:
incremental program watcher createSemanticDiagnosticsBuilderProgram
I tried example from here and the version with createSemanticDiagnosticsBuilderProgram still writes files to disk. Also it is much slower than version with createEmitAndSemanticDiagnosticsBuilderProgram.
(project ~140 files, size ~1MB. full compile ~8s, 'semantic' incremental compile ~3s, 'emitAndSemantic' incremental compile <0.5s)
Expected behavior:
No files written to disk. Performance is approximately same between createSemanticDiagnosticsBuilderProgram and createEmitAndSemanticDiagnosticsBuilderProgram
Actual behavior:
Files are written to disk and performance is much worse with createSemanticDiagnosticsBuilderProgram .
Related
tildeio/broccoli-typescript-compiler#57
#20234
The text was updated successfully, but these errors were encountered: