Bug 1125398 - Benchmark load: large objects, r=terrence
authorSteve Fink <sfink@mozilla.com>
Wed, 21 Jan 2015 12:35:19 -0800
changeset 239486 cbf05998774213ff117b64c9a85a65880699aed3
parent 239485 4bbb59685268cadedfd2c67eff58852412684c8b
child 239487 46cde5a19b8d62b8569ff6828e3732936250d8f6
push id500
push userjoshua.m.grant@gmail.com
push dateThu, 29 Jan 2015 01:48:36 +0000
reviewersterrence
bugs1125398
milestone38.0a1
Bug 1125398 - Benchmark load: large objects, r=terrence
js/src/devtools/gc-ubench/benchmarks/globalArrayLargeObject.js
js/src/devtools/gc-ubench/index.html
new file mode 100644
--- /dev/null
+++ b/js/src/devtools/gc-ubench/benchmarks/globalArrayLargeObject.js
@@ -0,0 +1,23 @@
+window.tests.set('globalArrayLargeObject', (function() {
+var garbage = [];
+var garbageIndex = 0;
+return {
+    description: "var foo = { LARGE }; # (large slots)",
+
+    load: (N) => { garbage = new Array(N); },
+    unload: () => { garbage = []; garbageIndex = 0; },
+
+    defaultGarbageTotal: "8K",
+    defaultGarbagePerFrame: "200K",
+
+    makeGarbage: (N) => {
+        var obj = {};
+        for (var i = 0; i < N; i++) {
+            obj["key" + i] = i;
+        }
+        garbage[garbageIndex++] = obj;
+        if (garbageIndex == garbage.length)
+            garbageIndex = 0;
+    }
+};
+})());
--- a/js/src/devtools/gc-ubench/index.html
+++ b/js/src/devtools/gc-ubench/index.html
@@ -4,16 +4,17 @@
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
   <!-- Include benchmark modules. -->
   <script>var tests = new Map();</script>
   <script src="benchmarks/noAllocation.js"></script>
   <script src="benchmarks/globalArrayNewObject.js"></script>
   <script src="benchmarks/globalArrayArrayLiteral.js"></script>
   <script src="benchmarks/globalArrayLargeArray.js"></script>
+  <script src="benchmarks/globalArrayLargeObject.js"></script>
   <script src="benchmarks/globalArrayObjectLiteral.js"></script>
   <script src="benchmarks/globalArrayReallocArray.js"></script>
   <script src="benchmarks/selfCyclicWeakMap.js"></script>
   <script src="benchmarks/pairCyclicWeakMap.js"></script>
 
   <script src="harness.js"></script>
 
 </head>
@@ -42,17 +43,17 @@
 </div
 
 <div>
     &nbsp;&nbsp;&nbsp;&nbsp;Garbage items per frame:
     <input type="text" id="garbage-per-frame" size="5" value="8K"
            onchange="garbage_per_frame_changed()"></input>
 </div>
 <div>
-    &nbsp;&nbsp;&nbsp;&nbsp;Garbage heap size in items:
+    &nbsp;&nbsp;&nbsp;&nbsp;Garbage piles:
     <input type="text" id="garbage-total" size="5" value="8M"
            onchange="garbage_total_changed()"></input>
 </div>
 
 <div id="results-Area">
     Test Results:
     <div id="results-display" style="padding-left: 10px; border: 1px solid black;"></div>
 </div>