From Nolan Lawson, linked by Javascript Weekly:
When you load a website for the second or third time, if the JavaScript is cached correctly, then the browser doesn’t need to parse and compile the source code into bytecode anymore. It just loads the bytecode directly off disk. This is the bytecode cache in action.
Furthermore, if a function is “hot” (frequently executed), it will be further optimized into machine code. This is the JIT in action.
In the world of Node.js scripts, we don’t get the benefits of the bytecode cache at all. Every time you run a Node script, the entire script has to be parsed and compiled from scratch. This is a big reason for the reported perf wins between JavaScript and non-JavaScript tooling.
Thanks to the inimitable Joyee Cheung, though, Node is now getting a compile cache. You can set an environment variable and immediately get faster Node.js script loads:
export
NODE_COMPILE_CACHE=~/.cache
/nodejs-compile-cache
I’ve set this in my
~/.bashrc
on all my dev machines. I hope it makes it into the default Node settings someday
Is NODE_COMPILE_CACHE something that could be useful in conjunction with Meteor?