Debian Codegraph @

js/src/devtools/gc-ubench/benchmarks/largeArrayPropertyAndElements.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 "largeArrayPropertyAndElements",
7 (function() {
8 var garbage;
9 var index;
10
11 return {
12 description: "Large array with both properties and elements",
13
14 load: n => {
15 garbage = new Array(n);
16 garbage.fill(null);
17 index = 0;
18 },
19
20 unload: () => {
21 garbage = null;
22 index = 0;
23 },
24
25 defaultGarbagePiles: "100K",
26 defaultGarbagePerFrame: "48K",
27
28 makeGarbage: n => {
29 for (var i = 0; i < n; i++) {
30 index++;
31 index %= garbage.length;
32
33 var obj = {};
34 garbage[index] = obj;
35 garbage["key-" + index] = obj;
36 }
37 },
38 };
39 })()
40 );