Demystifying V8 and JavaScript Performance
summary
Benchmarks mask causes; probing V8 with flame graphs and reading engine code finds a garbage-collector stall that explains a slow Float32Array constructor. V8 represents values as 31‑bit Smis or boxed pointers, stores object layouts in maps/hidden classes with transitions, and uses fixed 32‑slot defaults then shrinks after ~8 instances. Typed arrays use unboxed linear backing, mixed or sparse arrays force dictionary mode, and the optimizing compiler triggers optimization hell on deopts or polymorphism. Initialize properties in order to avoid deoptimization.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 2:30Data Types
- 7:20Map
- 10:38Extra Properties
- 13:46Erase
- 14:48Linear Buffer
- 18:19Compilers
- 20:43Optimization
- 23:39Conclusion
related talks
33mJavaScript: The V8 Engine optimization tips (...)
28mV8 internals for JavaScript developers
30mV8 internals for JS developers
27mThe Life of a JavaScript Feature in V8 ft. TypedArrays
23mV8 Internals for JS Developers
23mJoin the super secret V8 club & become a JavaScriptbender
26mPractical Optimization for V8
28mPerformance Profiling for V8
