borc icon indicating copy to clipboard operation
borc copied to clipboard

Write up Performance Guide for JS Best Practices

Open dignifiedquire opened this issue 8 years ago • 1 comments

  • https://github.com/mraleph/irhydra
  • node --prof and node --prof-process
  • Chrome JavaScript profile
  • asm.js http://asmjs.org/
  • benchmark.js
  • measure, measure, measure
  • hot code paths
  • the fastest code is the one that doesn't run
    • early exits
    • reuse variables to avoid memory allocations
  • Types are important
    • arrays
      • fixed sized arrays are better than growing & shrinking
      • all elements in an array should be of the same type (ideal 32 bit ints)
    • initialise variables with the correct type
    • avoid using objects
    • don't resize buffers

dignifiedquire avatar Nov 22 '16 21:11 dignifiedquire

@dignifiedquire 🙏🏽

daviddias avatar Jan 26 '18 19:01 daviddias