-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Move TypeScript to a seperate isolate #1190
Comments
@kitsonk My suggestion is to allow bundle user code into single bundle with command |
@anjmao that is #21. Currently Deno (now and when this lands) will simply load all cached transpiled code. The bundle though is still a good idea. The other thing that is a little bit of a challenge at the moment is that we don't support ES modules directly, so even JavaScript code needs to be transpiled. That is #975. But delivery of both of those still means we need an efficient way of supporting the TypeScript compiler within Deno and lazy loading it will give us a big boost, likely even a boost on cold startup. The snapshotting is actually really effective and if we are eventually maybe even able to customise snapshots with bundles... 🎉 🍾 |
Using this approach, can additional isolates such as one for CoffeeScript 2 (which supports native ES modules) one day be supported? |
@shreeve Sure, I'd like to make the system general enough to support alternative compilations - but it's a ways off - we have to get this big landed and cleaned up first. |
@ry - Excellent... deno is looking great! Thanks. |
@ry and I have been having a side conversation about breaking out TypeScript into a seperate isolate. TypeScript would then not be part of the runtime isolate where user code runs. There are potentially various benefits to this approach:
Based on that I created a POC (https://github.com/kitsonk/deno/tree/breakup-compiler) which will generate two binaries,
deno
which is the standard full featured build anddeno_runner
which is only capable of loading already cached/transpiled modules. If the module isn't cached locally,deno_runner
just fails rather ungracefully. This was to find out how much more efficient on "warm" startup.The binary size is pretty significantly reduced:
This is unlikely to be the case in the long term, as the binary would need to contain a TypeScript snapshot and could go back up to current size, but it shows that 40% of the binary is essentially related to TypeScript.
The performance is pretty interesting:
So on my machine, essentially doing exactly the same thing, startup for Deno is 2.5x faster. @ry did some tests on the branch as well, and discovered that actually runtime performance really isn't impacted.
On the surface, even if it doesn't buy us a specific runtime performance improvement at this point, it just feels that the approach of separating TypeScript and runtime into seperate isolates would be an overall net benefit with no identifiable downsides at this point.
The text was updated successfully, but these errors were encountered: