]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/js1_5/Array/regress-101964.js
2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is mozilla.org code.
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation.
17 * All Rights Reserved.
19 * Contributor(s): pschwartau@netscape.com
20 * Date: 27 September 2001
22 * SUMMARY: Performance: truncating even very large arrays should be fast!
23 * See http://bugzilla.mozilla.org/show_bug.cgi?id=101964
25 * Adjust this testcase if necessary. The FAST constant defines
26 * an upper bound in milliseconds for any truncation to take.
28 //-----------------------------------------------------------------------------
31 var summary
= 'Performance: truncating even very large arrays should be fast!';
34 var FAST
= 50; // array truncation should be 50 ms or less to pass the test
35 var MSG_FAST
= 'Truncation took less than ' + FAST
+ ' ms';
36 var MSG_SLOW
= 'Truncation took ';
41 var actualvalues
= [];
43 var expectedvalues
= [];
47 status
= inSection(1);
49 var start
= new Date();
51 actual
= elapsedTime(start
);
57 //-----------------------------------------------------------------------------
59 //-----------------------------------------------------------------------------
63 function elapsedTime(startTime
)
65 return new Date() - startTime
;
71 statusitems
[UBound
] = status
;
72 actualvalues
[UBound
] = isThisFast(actual
);
73 expectedvalues
[UBound
] = isThisFast(expect
);
78 function isThisFast(ms
)
82 return MSG_SLOW
+ ms
+ MSG_MS
;
90 printStatus (summary
);
92 for (var i
=0; i
<UBound
; i
++)
94 reportCompare(expectedvalues
[i
], actualvalues
[i
], statusitems
[i
]);