From 5512694ec42c3ee12f1f287da0f50921103672d9 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Mon, 26 Jan 2015 15:27:18 -0800 Subject: [PATCH] Bug 1125398 - Benchmark load: simple events, r=terrence --HG-- extra : rebase_source : b7cdda46c91f9cdccf48a5d473b3f6cac5e0ad06 --- .../devtools/gc-ubench/benchmarks/events.js | 25 ++++++++++++++++++ .../gc-ubench/benchmarks/expandoEvents.js | 26 +++++++++++++++++++ js/src/devtools/gc-ubench/index.html | 2 ++ 3 files changed, 53 insertions(+) create mode 100644 js/src/devtools/gc-ubench/benchmarks/events.js create mode 100644 js/src/devtools/gc-ubench/benchmarks/expandoEvents.js 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 000000000000..37f91f754239 --- /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 000000000000..70ff780c4e36 --- /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/index.html b/js/src/devtools/gc-ubench/index.html index cc0de0a92ff9..15d4f5d981e0 100644 --- a/js/src/devtools/gc-ubench/index.html +++ b/js/src/devtools/gc-ubench/index.html @@ -18,6 +18,8 @@ + +