blob: d6efa52d236fb3dcf9947df411e16430a02d825b [file] [log] [blame]
function foo(arg) {
return [...arg];
}
noInline(foo);
let arrays = [ ];
const size = 500;
{
let arr = [];
for (let i = 0; i < size; i++) {
arr.push(i);
}
arrays.push(arr);
}
{
let arr = [];
for (let i = 0; i < size; i++) {
arr.push(i + 0.5);
}
arrays.push(arr);
}
{
let arr = [];
for (let i = 0; i < size; i++) {
arr.push({i: i});
}
arrays.push(arr);
}
let start = Date.now();
for (let i = 0; i < 100000; i++) {
let array = arrays[i % arrays.length];
foo(array);
}
const verbose = false;
if (verbose)
print(Date.now() - start);