First hold down ctrl+shift+i to view the console and then click the "Run Test" button.
On arrays larger than 15,044 elements, Chromium 76's shift() performance degrades significantly compared to Firefox 69.
function shiftTest(numberOfElements)
{
let x = 0;
let ary = [];
while (x !== numberOfElements)
{
ary.push(x);
x += 1;
}
console.time(`Shifted ${no$Int(numberOfElements)} elements in `);
while(ary.length > 0)
{
ary.shift();
}
console.timeEnd(`Shifted ${no$Int(numberOfElements)} elements in `);
}
function runTest()
{
console.time("All tests combined completed in ");
let y = 0;
while (y < 15000)
{
shiftTest(y);
y += 100;
}
while (y < 15100)
{
shiftTest(y);
y += 1;
}
y = 20000;
while (y < 150001)
{
shiftTest(y);
y += 5000;
}
console.timeEnd("All tests combined completed in ");
}
// These last two functions are just for adding commas to the element counts.
function $(dollarAmount)
{
let locale = 'en-US';
let options = { style: 'currency', currency: 'USD' };
return Intl.NumberFormat(locale, options).format(dollarAmount);
}
function no$Int(dollarAmount)
{
return $(dollarAmount).replace('$','').split('.')[0];
}