News for hackers. Stuff that matters.
Re:Ask HN: Which abandoned proprietary software would you re... by nojvek on Saturday December 08, 2018 @12:03PM (#18636153)
Why is JavaScript the worst choice of you care about performance ?
Re:Ask HN: Which abandoned proprietary software would you re... by TeMPOraL on Saturday December 08, 2018 @02:11PM (#18636922)
Because the runtimes aren't meant for small, high-performance app, and the language itself doesn't (or wasn't, until recently) give you the primitives necessary for writing high-performance code.
Re:Ask HN: Which abandoned proprietary software would you re... by cztomsik on Saturday December 08, 2018 @02:12PM (#18636924)
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.