mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 19:48:12 +00:00

PR-URL: https://github.com/nodejs/node/pull/28918 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
33 lines
674 B
JavaScript
33 lines
674 B
JavaScript
// Copyright 2019 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
function setupArrayMap(length) {
|
|
var a = new Array(length);
|
|
for (var i=0;i<length;i++) {
|
|
a[i] = ''+i;
|
|
}
|
|
return Object.freeze(a);
|
|
}
|
|
|
|
const frozenArrayMap = setupArrayMap(200);
|
|
|
|
function driverArrayMap(n) {
|
|
let result = 0;
|
|
for (var i=0;i<n;i++) {
|
|
result = frozenArrayMap.map(Number);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function ArrayMap() {
|
|
driverArrayMap(1e3);
|
|
}
|
|
|
|
function ArrayMapWarmUp() {
|
|
driverArrayMap(1e1);
|
|
driverArrayMap(1e2);
|
|
}
|
|
|
|
createSuite('ArrayMap', 10, ArrayMap, ArrayMapWarmUp);
|