DEV Community

Discussion on: Javascript Array.push is 945x faster than Array.concat 🤯🤔

Collapse
 
adyngom profile image
Ady Ngom

Great stuff, I have so much love for jsperf.com that I remember being very upset for a while when it went down for a while. Glad to have it back up, I have recently used it to check the performance on different solutions the Sock Merchant Challenge, please check the comments section if you have a sec

My question though is that since some have expressed possible bias on certain browsers, how much do we trust or should rely on the built in console.time method running in a browserless environment such as node to provide a base for such benchmarks;

console.time('how long');
  plzBenchMarkMe();
console.timeEnd('how long');

If this is an objective and efficient way of testing speed, it should be easy to put a wrapper around it for reuse, if not what do folks recommend as tools to look into for this crucial exercise

Collapse
 
shiling profile image
Shi Ling

Huh, I didn't know there's a console.time and console.timeEnd methods.

Been using new Date() all along :D.

I don't know if JsPerf uses console.time and console.timeEnd under the hood, but the underlying implementations of the timer method can't be so sophisticated that it'll make a significant impact on the tests between browsers.