Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (12 sloc) 676 Bytes

V8 Performance Tips

A collection of V8 performance tips from Lars Bak

  • members used should be initialized in the constructor - in a consistent order
  • avoid monkey-patching which changes the hidden class tree, thus cannot use the same optimized code
  • 31 bit signed integers (SMIs) when possible for calculations
  • 0-N contiguous element arrays
  • pre-alloc small arrays
  • dont pre-alloc large arrays, switches to hash-mode
  • arrays of doubles can be unboxed
  • intiialize arrays using array literals to avoid conversions, re-allocations etc
  • use --trace-opt, --trace-bailout, --trace-deopt, --prof etc
  • Google\ Chrome --js-flags "--trace-opt ..."