Debian Codegraph @

js/src/devtools/gc-ubench/benchmarks/globalArrayLargeArray.js

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 tests.set(
6 "globalArrayLargeArray",
7 (function() {
8 var garbage = [];
9 var garbageIndex = 0;
10 return {
11 description: "var foo = [[...], ....]",
12 defaultGarbagePerFrame: "3M",
13 defaultGarbagePiles: "1K",
14
15 load: N => {
16 garbage = new Array(N);
17 },
18 unload: () => {
19 garbage = [];
20 garbageIndex = 0;
21 },
22 makeGarbage: N => {
23 var a = new Array(N);
24 for (var i = 0; i < N; i++) {
25 a[i] = N - i;
26 }
27 garbage[garbageIndex++] = a;
28 if (garbageIndex == garbage.length) {
29 garbageIndex = 0;
30 }
31 },
32 };
33 })()
34 );