Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // |reftest| skip -- bogus perf test (bug 540512)
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 451974;
9 var summary = 'TM: loops with anon functions should not be slower with jit enabled';
10 var actual = '';
11 var expect = '';
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
24 var chars = '0123456789abcdef';
25 var size = 10000;
26 var mult = 1000;
27 var densearray = [];
28 var lsize = size;
30 while (lsize--)
31 {
32 densearray.push(chars);
33 }
35 function loop()
36 {
37 var start = new Date();
39 for (var a = 0; a < mult; a++)
40 {
41 var f = (function(x){});
42 for (var i = 0, len = densearray.length; i < len; i++)
43 {
44 f(densearray[i]);
45 }
46 }
48 var stop = new Date();
49 return stop - start;
50 }
52 jit(false);
53 var timenonjit = loop();
54 jit(true);
55 var timejit = loop();
56 jit(false);
58 print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
60 expect = true;
61 actual = timejit < timenonjit/2;
63 reportCompare(expect, actual, summary);
65 exitFunc ('test');
66 }