-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Compare bootstrap speed with Node.js #45
Comments
it's not related to Golang but V8 and TS, as far as I know, Ryan is going to fix this issue by using V8 snapshots : ) |
I compiled a nodejs without snapshot ./configure --without-snapshot --prefix "$BASE_DIR/" But the performance didn't drop a lot time node index.js
Hello world
real 0m0.167s
user 0m0.123s
sys 0m0.042s |
@hefangshi You've pointed out the issue that bothers me the most. But it's not Golang - it's the TypeScript compiler getting loaded, parsed, and then parsing the input. I believe snapshots will make this much faster ... work is in progress to fix it. PS if you want to see the speed of Golang startup try |
@ry You are right. I do encounter with some issue of the golang startup performance in other extreme scenario, glad to know that deno don't have this issue. Although snapshot for ts may reduce typescript load time, but compile time is still hard to improve, maybe deno could provide precomiled running mode for production enviroment in future. |
@hefangshi Deno caches the compiled code (see and about production mode you're probably addressing #21 : ) |
@qti3e #21 was good to go, however I have another proposal. Deno is absolutely based on TypeScript, such that we actually can compile the source code(TypeScript) into LLVM, and then we have 2 choices:
|
What about using something that removes the types when run in a production build https://github.com/alangpierce/sucrase? |
@benjamingr I want only one transpiler compiled in and that is TS. I am confident that V8 snapshotting plus other startup optimizations will reduce startup time substantially. I will know soon and report back. |
Is it workable that rewrite TS compiler with golang? |
I highly doubt it is workable to rewrite TypeScript in Go. Because it wouldn't only be the language extensions on JavaScript, but a whole JavaScript engine, which is like rewriting the whole of V8 in another language. Even if it were cleanly separable, you would be ignoring the hundreds of people maintaining TypeScript and always be playing catchup. V8 snapshots are the easiest way to find out if they solve the challenge before exploring other solutions. |
I think it's not the golang too, but the TS. I'm pretty curious how will optimize the TS part - it's impossible ;d But let's believe. |
Why not just AOT compile javascript/Typescript to a single native binary. Why use V8 runtime? |
You would have to have all code be knowable at run time, including the programme. At that point you are talking about static compilers for JavaScript like EncloseJS or nexe. Both those projects are not deno, both of those projects are already available if that is what you need. |
I think the best of both worlds would be as the goals for file extensions suggest to only run through a TypeScript compiler if it is a Edit: Though i think if the core modules are written in '.ts' you would still have to compile that through TypeScript irregardless. So these sound like interesting design decision yet to be finalized depending on the tradeoffs. |
@thysultan make sense, i thought about that too. |
@ry maybe it should be closed by now (?) |
Yep - snapshots are running now and start up is much better - but we aren’t yet on feature parity with the Go implementation so a bit hard to compare. Closing this and will publish some benchmarks soon |
Just FYI our benchmarks in this area have improved
|
Now all `JsRealm` instances have a `ModuleMap`, but only the "main realm" `ModuleMap` is being used. Co-authored-by: Andreu Botella <andreu@andreubotella.com>
➜ tmp echo "console.log('Hello world')" > index.js
➜ tmp time deno index.js
Hello world
deno index.js 1.89s user 0.22s system 138% cpu 1.515 total
➜ tmp time node index.js
Hello world
node index.js 0.08s user 0.03s system 94% cpu 0.109 total
The golang runtime has a huge influence for bootstrap time. How you think about this, seems golang bootstrap time is had to improve.
The text was updated successfully, but these errors were encountered: