How much performance can you get out of Javascript?
summary
Measures raw CPU-bound work by finding 25,000 primes, comparing a like-for-like C++ baseline to JavaScript on V8. Initial JS runs ~4× slower, but after fixing a bounds bug, preallocating arrays, stabilizing hidden classes and types, and using Ignition and Turbofan optimizations JS approaches native speed (within ~45%), while adding type hints yields ~10% gain and a better algorithm gives ~30× speedup. Uses V8 tracing/profiler and Chrome flags; use WebAssembly only when JS semantics limit performance.
AI-written summary · about
chapters (8)
- 0:00Introduction and background
- 5:51How V8 optimizes JavaScript
- 16:50Hidden classes and type tracking
- 22:10TurboFan and optimizing compiler
- 27:52Avoiding optimization pitfalls
- 31:03Benchmarking and real-world fixes
- 34:20Performance comparison with C++
- 37:13Q&A
related talks
46mHow much performance can you get out of JavaScript?
27mSpeed, Speed, Speed: JavaScript vs C++ vs WebAssembly
27mSpeed, Speed, Speed: Javascript vs C++ vs WebAssembly
16mJavaScript & Metaperformance
29mExtreme JavaScript Performance
34mUnderstanding JavaScript Performance
31mJavaScript Compilation Techniques or "Wasn't JavaScript supposed to be slow?"
30mNative Speed on the Web: JavaScript and asm.js
