←back to thread

160 points todsacerdoti | 1 comments | | HN request time: 0.201s | source
Show context
showsomerespect ◴[] No.41904336[source]
Running a blank .js file in node took 66 milliseconds. An optimized binary I wrote in rust takes 2 milliseconds to execute. So, I think there's a cap there on how fast JavaScript tools can be
replies(1): >>41906435 #
WorldMaker ◴[] No.41906435[source]
This is addressed in the article. Node doesn't cache an JS compilation data by default. There's an environment flag to turn that on, and the startup time drastically reduces with it on (on the second+ run of the file).

Also both Deno and Bun have more optimized startup times in general by default, some of that startup time is just Node, not a reflection of the language itself.

replies(1): >>41913779 #
Alifatisk ◴[] No.41913779[source]
Which env flag are you referring to? "--experimental-vm-modules"? Or maybe "--experimental-policy"?
replies(1): >>41914018 #
WorldMaker ◴[] No.41914018[source]
`export NODE_COMPILE_CACHE=~/.cache/nodejs-compile-cache`
replies(1): >>41915198 #
1. Alifatisk ◴[] No.41915198[source]
Had no idea about this, thanks!