js/src/devtools/gc/tests/loops.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 //Measure plain GC.
     3 var t = [];
     4 var N = 500000
     6 for(var i = 0; i < N; i++)
     7     t[i] = {};
     9 gc()
    11 t = [];
    13 gc();
    15 for(var i = 0; i < N; i++)
    16     t[i] = ({});
    18 gc();
    20 t = [];
    22 gc();
    25 for(var i = 0; i < N; i++)
    26     t[i] = "asdf";
    28 gc();
    30 t = [];
    32 gc();
    35 for(var i = 0; i < N; i++)
    36     t[i] = 1.12345;
    38 gc();
    40 t=[];
    42 gc();
    44 for(var i = 0; i < N; i++) {
    45     t[i] = ({});
    46     if (i != 0)
    47         t[i].a = t[i-1];
    48 }
    50 gc();
    52 t = [];
    54 gc();

mercurial