js/src/tests/js1_8_1/jit/regress-451974-01.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:6f9df0b8932a
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/. */
6
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 = '';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15
16 var chars = '0123456789abcdef';
17 var size = 10000;
18 var mult = 1000;
19 var densearray = [];
20 var lsize = size;
21
22 while (lsize--)
23 {
24 densearray.push(chars);
25 }
26
27 function loop()
28 {
29 var start = new Date();
30
31 for (var a = 0; a < mult; a++)
32 {
33 var f = (function(x){});
34 for (var i = 0, len = densearray.length; i < len; i++)
35 {
36 f(densearray[i]);
37 }
38 }
39
40 var stop = new Date();
41 return stop - start;
42 }
43
44 jit(false);
45 var timenonjit = loop();
46 jit(true);
47 var timejit = loop();
48 jit(false);
49
50 print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
51
52 expect = true;
53 actual = timejit < timenonjit/2;
54
55 reportCompare(expect, actual, summary);

mercurial