Bug 1633625 - Add new "deepWeakMap" mutator load r=jonco
authorSteve Fink <sfink@mozilla.com>
Tue, 19 May 2020 21:54:58 +0000
changeset 530906 28980e6af06f087d210ffeb435c4b396f813d063
parent 530905 7e985178f7dc91eb37ae89643a6825be0a3f1665
child 530907 6fd685c690a80000c5736b02cbaa59716d0d0269
push id37434
push userabutkovits@mozilla.com
push dateWed, 20 May 2020 10:05:10 +0000
treeherdermozilla-central@005ef1c25992 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1633625
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1633625 - Add new "deepWeakMap" mutator load r=jonco Differential Revision: https://phabricator.services.mozilla.com/D75005
js/src/devtools/gc-ubench/benchmarks/deepWeakMap.js
js/src/devtools/gc-ubench/test_list.js
new file mode 100644
--- /dev/null
+++ b/js/src/devtools/gc-ubench/benchmarks/deepWeakMap.js
@@ -0,0 +1,40 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+tests.set(
+  "deepWeakMap",
+  (function() {
+    var garbage = [];
+    var garbageIndex = 0;
+    return {
+      description: "o={wm,k}; w.mk[k]=o2={wm2,k2}; wm2[k2]=....",
+
+      defaultGarbagePerFrame: "1K",
+      defaultGarbagePiles: "1K",
+
+      load: N => {
+        garbage = new Array(N);
+      },
+
+      unload: () => {
+        garbage = [];
+        garbageIndex = 0;
+      },
+
+      makeGarbage: M => {
+        var initial = {};
+        var prev = initial;
+        for (var i = 0; i < M; i++) {
+          var obj = [new WeakMap(), Object.create(null)];
+          obj[0].set(obj[1], prev);
+          prev = obj;
+        }
+        garbage[garbageIndex++] = initial;
+        if (garbageIndex == garbage.length) {
+          garbageIndex = 0;
+        }
+      },
+    };
+  })()
+);
--- a/js/src/devtools/gc-ubench/test_list.js
+++ b/js/src/devtools/gc-ubench/test_list.js
@@ -6,14 +6,15 @@ function foreach_test_file(callback) {
   callback("benchmarks/globalArrayLargeObject.js");
   callback("benchmarks/globalArrayObjectLiteral.js");
   callback("benchmarks/globalArrayReallocArray.js");
   callback("benchmarks/globalArrayBuffer.js");
   callback("benchmarks/globalArrayFgFinalized.js");
   callback("benchmarks/largeArrayPropertyAndElements.js");
   callback("benchmarks/selfCyclicWeakMap.js");
   callback("benchmarks/pairCyclicWeakMap.js");
+  callback("benchmarks/deepWeakMap.js");
   callback("benchmarks/textNodes.js");
   callback("benchmarks/bigTextNodes.js");
   callback("benchmarks/events.js");
   callback("benchmarks/expandoEvents.js");
   callback("benchmarks/propertyTreeSplitting.js");
 }