you can always use console.time('timerName')
and console.timeEnd('timerName')
to set a timer and find out elapsed time between two points of your javascript code, then compare the results:
console.time('BigArray');
var arr1 = [];
for(var i=0; i<200000; i++){
arr1.push('test');
}
console.timeEnd('BigArray');
console.time('SeveralArrays');
for(var i=0; i<200000; i++){
var arr2 = ['test'];
}
console.timeEnd('SeveralArrays');
the output will be something like:
BigArray: 123ms
SeveralArrays: 456ms