-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Incremental compilation for TypeScript #6428
Incremental compilation for TypeScript #6428
Conversation
Fixes #6194? |
Not sure why, but using |
A couple thoughts... What does it look like for a small workload? What is the initial build for both? It might not make sense to do this all the time, especially if there is a "small workload" tax, which the previous PR demonstrated there was, or if there is an initial build cost. |
Checking benchmarks I get
Looks like it's twice as fast 🚀 |
@kitsonk please review |
serde_json::to_string(self) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - waiting on @kitsonk's approval before landing.
|
@kitsonk I wanted to land #6434 before this PR, but it turns out it can't really be used for
That's a bit unlucky as I really wanted to get in-depth stats for incremental compilation 😢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR adds incremental compilation capabilities to internal TS compiler.
Instead of using
ts.createProgram()
for "compilation" step (during deno startup)ts.createIncrementalProgram()
API is used. Due to problems with source map (that are not fully understood) I changed compilation settings to inline source map (inlineSourceMap
instead ofsourceMap
).Thanks to
.tsbuildinfo
file that already stores all necessary metadata for compilation I was able to remove our own invention that is.graph
files..tsbuildinfo
file is stored alongside compiled source and is used to cache-bust outdated dependencies - it's facilitated byversion
field. This value is computed in Rust during loading of module graph (basically a hash of file contents).Please keep in mind that incremental compilation is only used for initial compilation (or dynamic imports compilation) - bundling and runtime compiler APIs haven't been changed at all.
Based on #5094
Ref #4323
Fixes #6194
Did some tests using
oak
. Changingmod.ts
back and forth by adding a comment I got following results:v1.1.1
this PR
CC @ry @kitsonk