diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/devtools/gc-ubench/benchmarks | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/devtools/gc-ubench/benchmarks')
17 files changed, 379 insertions, 0 deletions
diff --git a/js/src/devtools/gc-ubench/benchmarks/bigTextNodes.js b/js/src/devtools/gc-ubench/benchmarks/bigTextNodes.js new file mode 100644 index 000000000..1a6119f56 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/bigTextNodes.js @@ -0,0 +1,25 @@ +window.tests.set('bigTextNodes', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var foo = [ textNode, textNode, ... ]", + + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + + defaultGarbagePerFrame: "8", + defaultGarbageTotal: "8", + + makeGarbage: (N) => { + var a = []; + var s = "x"; + for (var i = 0; i < 16; i++) + s = s + s; + for (var i = 0; i < N; i++) + a.push(document.createTextNode(s)); + garbage[garbageIndex++] = a; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/events.js b/js/src/devtools/gc-ubench/benchmarks/events.js new file mode 100644 index 000000000..37f91f754 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/events.js @@ -0,0 +1,25 @@ +window.tests.set('events', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var foo = [ textNode, textNode, ... ]", + + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + + defaultGarbagePerFrame: "100K", + defaultGarbageTotal: "8", + + makeGarbage: (N) => { + var a = []; + for (var i = 0; i < N; i++) { + var e = document.createEvent("Events"); + e.initEvent("TestEvent", true, true); + a.push(e); + } + garbage[garbageIndex++] = a; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/expandoEvents.js b/js/src/devtools/gc-ubench/benchmarks/expandoEvents.js new file mode 100644 index 000000000..70ff780c4 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/expandoEvents.js @@ -0,0 +1,26 @@ +window.tests.set('expandoEvents', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var foo = [ textNode, textNode, ... ]", + + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + + defaultGarbagePerFrame: "100K", + defaultGarbageTotal: "8", + + makeGarbage: (N) => { + var a = []; + for (var i = 0; i < N; i++) { + var e = document.createEvent("Events"); + e.initEvent("TestEvent", true, true); + e.color = ["tuna"]; + a.push(e); + } + garbage[garbageIndex++] = a; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/globalArrayArrayLiteral.js b/js/src/devtools/gc-ubench/benchmarks/globalArrayArrayLiteral.js new file mode 100644 index 000000000..9982090d8 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/globalArrayArrayLiteral.js @@ -0,0 +1,16 @@ +window.tests.set('globalArrayArrayLiteral', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var foo = [[], ....]", + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + makeGarbage: (N) => { + for (var i = 0; i < N; i++) { + garbage[garbageIndex++] = ['foo', 'bar', 'baz', 'baa']; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/globalArrayBuffer.js b/js/src/devtools/gc-ubench/benchmarks/globalArrayBuffer.js new file mode 100644 index 000000000..4aee22ee7 --- /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; + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/globalArrayFgFinalized.js b/js/src/devtools/gc-ubench/benchmarks/globalArrayFgFinalized.js new file mode 100644 index 000000000..f2f914376 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/globalArrayFgFinalized.js @@ -0,0 +1,23 @@ +window.tests.set('globalArrayFgFinalized', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var foo = [ new Map, new Map, ... ]; # (foreground finalized)", + + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + + defaultGarbageTotal: "8K", + defaultGarbagePerFrame: "1M", + + makeGarbage: (N) => { + var arr = []; + for (var i = 0; i < N; i++) { + arr.push(new Map); + } + garbage[garbageIndex++] = arr; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/globalArrayLargeArray.js b/js/src/devtools/gc-ubench/benchmarks/globalArrayLargeArray.js new file mode 100644 index 000000000..2c0ff3564 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/globalArrayLargeArray.js @@ -0,0 +1,18 @@ +window.tests.set('globalArrayLargeArray', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var foo = [[...], ....]", + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + makeGarbage: (N) => { + var a = new Array(N); + for (var i = 0; i < N; i++) { + a[i] = N - i; + } + garbage[garbageIndex++] = a; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/globalArrayLargeObject.js b/js/src/devtools/gc-ubench/benchmarks/globalArrayLargeObject.js new file mode 100644 index 000000000..d676c255e --- /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; + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/globalArrayNewObject.js b/js/src/devtools/gc-ubench/benchmarks/globalArrayNewObject.js new file mode 100644 index 000000000..2ab04dff0 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/globalArrayNewObject.js @@ -0,0 +1,16 @@ +window.tests.set('globalArrayNewObject', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var foo = [new Object(), ....]", + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + makeGarbage: (N) => { + for (var i = 0; i < N; i++) { + garbage[garbageIndex++] = new Object(); + if (garbageIndex == garbage.length) + garbageIndex = 0; + } + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/globalArrayObjectLiteral.js b/js/src/devtools/gc-ubench/benchmarks/globalArrayObjectLiteral.js new file mode 100644 index 000000000..7a8c1b2d6 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/globalArrayObjectLiteral.js @@ -0,0 +1,16 @@ +window.tests.set('globalArrayObjectLiteral', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var foo = [{}, ....]", + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + makeGarbage: (N) => { + for (var i = 0; i < N; i++) { + garbage[garbageIndex++] = {a: 'foo', b: 'bar', 0: 'foo', 1: 'bar'}; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/globalArrayReallocArray.js b/js/src/devtools/gc-ubench/benchmarks/globalArrayReallocArray.js new file mode 100644 index 000000000..6a7b16011 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/globalArrayReallocArray.js @@ -0,0 +1,18 @@ +window.tests.set('globalArrayReallocArray', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var foo = [[,,,], ....]", + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + makeGarbage: (N) => { + var a = []; + for (var i = 0; i < N; i++) { + a[i] = N - i; + } + garbage[garbageIndex++] = a; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/largeArrayPropertyAndElements.js b/js/src/devtools/gc-ubench/benchmarks/largeArrayPropertyAndElements.js new file mode 100644 index 000000000..36ae04971 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/largeArrayPropertyAndElements.js @@ -0,0 +1,34 @@ +window.tests.set('largeArrayPropertyAndElements', (function() { + var garbage; + var index; + + return { + description: "Large array with both properties and elements", + + load: n => { + garbage = new Array(n); + garbage.fill(null); + index = 0; + }, + + unload: () => { + garbage = null; + index = 0; + }, + + defaultGarbageTotal: "100K", + defaultGarbagePerFrame: "30K", + + makeGarbage: n => { + for (var i = 0; i < n; i++) { + index++; + index %= garbage.length; + + var obj = {}; + garbage[index] = obj; + garbage["key-" + index] = obj; + } + } + }; + +}())); diff --git a/js/src/devtools/gc-ubench/benchmarks/noAllocation.js b/js/src/devtools/gc-ubench/benchmarks/noAllocation.js new file mode 100644 index 000000000..5e01c309b --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/noAllocation.js @@ -0,0 +1,6 @@ +window.tests.set('noAllocation', { + description: "Do not generate any garbage.", + load: (N) => {}, + unload: () => {}, + makeGarbage: (N) => {} +}); diff --git a/js/src/devtools/gc-ubench/benchmarks/pairCyclicWeakMap.js b/js/src/devtools/gc-ubench/benchmarks/pairCyclicWeakMap.js new file mode 100644 index 000000000..4dcb4d57e --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/pairCyclicWeakMap.js @@ -0,0 +1,33 @@ +window.tests.set('pairCyclicWeakMap', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "wm1[k1] = k2; wm2[k2] = k3; wm1[k3] = k4; wm2[k4] = ...", + + defaultGarbagePerFrame: "1K", + defaultGarbageTotal: "1K", + + load: (N) => { garbage = new Array(N); }, + + unload: () => { garbage = []; garbageIndex = 0; }, + + makeGarbage: (M) => { + var wm1 = new WeakMap(); + var wm2 = new WeakMap(); + var initialKey = {}; + var key = initialKey; + var value = {}; + for (var i = 0; i < M/2; i++) { + wm1.set(key, value); + key = value; + value = {}; + wm2.set(key, value); + key = value; + value = {}; + } + garbage[garbageIndex++] = [ initialKey, wm1, wm2 ]; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/propertyTreeSplitting.js b/js/src/devtools/gc-ubench/benchmarks/propertyTreeSplitting.js new file mode 100644 index 000000000..47001030f --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/propertyTreeSplitting.js @@ -0,0 +1,25 @@ +window.tests.set('propertyTreeSplitting', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "use delete to generate Shape garbage", + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + makeGarbage: (N) => { + function f() + { + var a1 = eval; + delete eval; + eval = a1; + var a3 = toString; + delete toString; + toString = a3; + } + for (var a = 0; a < N; ++a) { + garbage[garbageIndex++] = new f(); + if (garbageIndex == garbage.length) + garbageIndex = 0; + } + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/selfCyclicWeakMap.js b/js/src/devtools/gc-ubench/benchmarks/selfCyclicWeakMap.js new file mode 100644 index 000000000..0a5ffb084 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/selfCyclicWeakMap.js @@ -0,0 +1,29 @@ +window.tests.set('selfCyclicWeakMap', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var wm = new WeakMap(); wm[k1] = k2; wm[k2] = k3; ...", + + defaultGarbagePerFrame: "1K", + defaultGarbageTotal: "1K", + + load: (N) => { garbage = new Array(N); }, + + unload: () => { garbage = []; garbageIndex = 0; }, + + makeGarbage: (M) => { + var wm = new WeakMap(); + var initialKey = {}; + var key = initialKey; + var value = {}; + for (var i = 0; i < M; i++) { + wm.set(key, value); + key = value; + value = {}; + } + garbage[garbageIndex++] = [ initialKey, wm ]; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } +}; +})()); diff --git a/js/src/devtools/gc-ubench/benchmarks/textNodes.js b/js/src/devtools/gc-ubench/benchmarks/textNodes.js new file mode 100644 index 000000000..257e5f726 --- /dev/null +++ b/js/src/devtools/gc-ubench/benchmarks/textNodes.js @@ -0,0 +1,23 @@ +window.tests.set('textNodes', (function() { +var garbage = []; +var garbageIndex = 0; +return { + description: "var foo = [ textNode, textNode, ... ]", + + load: (N) => { garbage = new Array(N); }, + unload: () => { garbage = []; garbageIndex = 0; }, + + defaultGarbagePerFrame: "100K", + defaultGarbageTotal: "8", + + makeGarbage: (N) => { + var a = []; + for (var i = 0; i < N; i++) { + a.push(document.createTextNode("t" + i)); + } + garbage[garbageIndex++] = a; + if (garbageIndex == garbage.length) + garbageIndex = 0; + } +}; +})()); |