by zigzigzag · 10y ago · 0 comments
The main reason Node is so slow is that, as you point out, it doesn't do threading at all, and JavaScript is just inherently difficult to optimise into machine code, even though V8 makes a good effort.
I would blame the highly dynamic nature of the language for (relative) slowness – the price you pay for flexibility / quickly-writable code. That being said, it's still fast for dynamically typed language.
It does not target your hardware architecture. Just because your code is in binary instead of text, it does not become less of an interpreter.
C-f for "Dynamic Machine Code Generation"
V8 compiles it to native machine code for execution. It's not an interpreter or a VM with its own bytecode.
This is a very interesting solution for JavaScript, but I think it's constrained by the language and could become better if it were fully compiled.