Test name | Executions per second |
---|---|
Push | 219023.0 Ops/sec |
Spread | 27234.5 Ops/sec |
window.top.tests = {push:[], spread:[]};
window.test = (new Array(10)).fill(null);
window.cutoff = 5000;
for (let element of window.test) {
window.top.tests.push.push(element);
}
if (window.top.tests.push.length > window.cutoff) { window.top.tests.push = []; console.log('reset push'); }
for (let element of window.test) {
window.top.tests.spread = [window.top.tests.spread, element];
}
if (window.top.tests.spread.length > window.cutoff) { window.top.tests.spread = []; console.log('reset spread'); }