Skip to content

Instantly share code, notes, and snippets.

View wojtossfm's full-sized avatar

Wojciech Michalak wojtossfm

View GitHub Profile
@yuval-a
yuval-a / js-micro.js
Last active October 9, 2024 13:09
Javascript micro-optimizations
NOTE: This document is OLD - and most of the tips here are probably outdated, since newer versions of Javascript have been
released over the years - with newer optimizations and more emphasis on optimizing newly supported syntax.
// Array literal (= []) is faster than Array constructor (new Array())
// http://jsperf.com/new-array-vs-literal/15
var array = [];
// Object literal (={}) is faster than Object constructor (new Object())
// http://jsperf.com/new-array-vs-literal/26