Bug 1125398 - Benchmark load: large ArrayBuffers (for big malloc data), r=terrence
authorSteve Fink <sfink@mozilla.com>
Wed, 21 Jan 2015 13:20:17 -0800
changeset 239488 8a5b30881128be12d13d0ce15d140cfa107ce5fb
parent 239487 46cde5a19b8d62b8569ff6828e3732936250d8f6
child 239489 97c12091bda58529f25bb518ff5f77c97ede55a8
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 ArrayBuffers (for big malloc data), r=terrence
js/src/devtools/gc-ubench/benchmarks/globalArrayBuffer.js
js/src/devtools/gc-ubench/index.html
new file mode 100644
--- /dev/null
+++ b/js/src/devtools/gc-ubench/benchmarks/globalArrayBuffer.js
@@ -0,0 +1,23 @@
+window.tests.set('globalArrayBuffer', (function() {
+var garbage = [];
+var garbageIndex = 0;
+return {
+    description: "var foo = ArrayBuffer(N); # (large malloc data)",
+
+    load: (N) => { garbage = new Array(N); },
+    unload: () => { garbage = []; garbageIndex = 0; },
+
+    defaultGarbageTotal: "8K",
+    defaultGarbagePerFrame: "4M",
+
+    makeGarbage: (N) => {
+        var ab = new ArrayBuffer(N);
+        var view = new Uint8Array(ab);
+        view[0] = 1;
+        view[N - 1] = 2;
+        garbage[garbageIndex++] = ab;
+        if (garbageIndex == garbage.length)
+            garbageIndex = 0;
+    }
+};
+})());
--- a/js/src/devtools/gc-ubench/index.html
+++ b/js/src/devtools/gc-ubench/index.html
@@ -7,16 +7,17 @@
   <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/globalArrayBuffer.js"></script>
   <script src="benchmarks/selfCyclicWeakMap.js"></script>
   <script src="benchmarks/pairCyclicWeakMap.js"></script>
   <script src="benchmarks/textNodes.js"></script>
   <script src="benchmarks/bigTextNodes.js"></script>
 
   <script src="harness.js"></script>
 
 </head>