📄️ Benchmarking your code - measuring execution time
Most performance tips are very dependent of the current state of JS engines and are expected to be only relevant at a given time. The fundamental law of performance optimization is that you must first measure before trying to optimize, and measure again after a presumed optimization.
📄️ Be consistent in use of Numbers
If the engine is able to correctly predict you're using a specific small type for your values, it will be able to optimize the executed code.
📄️ Limit DOM Updates
📄️ Prefer local variables to globals, attributes, and indexed values
📄️ Use a memoizer for heavy-computing functions
If you are building a function that may be heavy on the processor (either clientside or serverside) you may want to consider a memoizer which is a cache of previous function executions and their returned values. This allows you to check if the parameters of a function were passed before. Remember, pure functions are those that given an input, return a corresponding unique output and don't cause side-effects outside their scope so, you should not add memoizers to functions that are unpredictable or depend on external resources (like AJAX calls or randomly returned values).
📄️ Memory Efficiency
Drawback of creating true private method
📄️ Initializing object properties with null
📄️ Reuse objects rather than recreate
📄️ Avoid try/catch in performance-critical functions