automatic memory management makes certain optimizations very hard to do (you can't make cpu-cache-friendly array of structs)
javascript is very dynamic and V8 has very limited time to make its magic so the optimizations can't ever reach level of rust/c++ (but V8 can do some runtime-only optimizations)
it's very hard to predict performance of given code (and this itself is why it's the worst choice for perf-sensitive code, V8 is moving target, and what was fast yesterday might be slow tomorrow - so basically, it's not worth time and money to actually spend too much time optimizing javascript, it's much better to identify hot spots and do them in rust/c++)
It usually doesn't matter and it's more than fast enough for any kind of scripting, but it's certainly not a good fit for cpu-heavy tasks. I love javascript, to be clear.
BTW: run some node.js code with --print-opt-code so you have an idea how big amount of code is generated even for very simple things.
javascript is very dynamic and V8 has very limited time to make its magic so the optimizations can't ever reach level of rust/c++ (but V8 can do some runtime-only optimizations)
it's very hard to predict performance of given code (and this itself is why it's the worst choice for perf-sensitive code, V8 is moving target, and what was fast yesterday might be slow tomorrow - so basically, it's not worth time and money to actually spend too much time optimizing javascript, it's much better to identify hot spots and do them in rust/c++)
It usually doesn't matter and it's more than fast enough for any kind of scripting, but it's certainly not a good fit for cpu-heavy tasks. I love javascript, to be clear.
BTW: run some node.js code with --print-opt-code so you have an idea how big amount of code is generated even for very simple things.