summaryrefslogtreecommitdiffstats
path: root/js/src/devtools/gc/tests/loops.js
blob: a99961a3ef7ed4a7be5032e0ba58239c595a1b15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//Measure plain GC.

var t = [];
var N = 500000

for(var i = 0; i < N; i++)
    t[i] = {};

gc()

t = [];

gc();

for(var i = 0; i < N; i++)
    t[i] = ({});

gc();

t = [];

gc();


for(var i = 0; i < N; i++)
    t[i] = "asdf";
    
gc();

t = [];

gc();


for(var i = 0; i < N; i++)
    t[i] = 1.12345;
    
gc();

t=[];

gc();

for(var i = 0; i < N; i++) {
    t[i] = ({});
    if (i != 0)
        t[i].a = t[i-1];
}
    
gc();

t = [];

gc();