mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1125398 - Benchmark load: self-referential WeakMap, r=terrence
--HG-- extra : rebase_source : b15841d8795dd93b6009e57c76f87d33b6c5b34c
This commit is contained in:
parent
4aa286cfa8
commit
30ee3c7040
29
js/src/devtools/gc-ubench/benchmarks/selfCyclicWeakMap.js
Normal file
29
js/src/devtools/gc-ubench/benchmarks/selfCyclicWeakMap.js
Normal file
@ -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;
|
||||
}
|
||||
};
|
||||
})());
|
@ -11,6 +11,7 @@
|
||||
<script src="benchmarks/globalArrayLargeArray.js"></script>
|
||||
<script src="benchmarks/globalArrayObjectLiteral.js"></script>
|
||||
<script src="benchmarks/globalArrayReallocArray.js"></script>
|
||||
<script src="benchmarks/selfCyclicWeakMap.js"></script>
|
||||
|
||||
<script src="harness.js"></script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user