summaryrefslogtreecommitdiffstats
path: root/js/src/devtools/gc-ubench/benchmarks/globalArrayObjectLiteral.js
blob: 7a8c1b2d6335f10b43c04eb352e7f4ab66eb8c8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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;
        }
    }
};
})());