Bug 449371 Firefox/Thunderbird crashes at exit [@ gdk_display_x11_finalize], p=Brian...
[wine-gecko.git] / testing / performance / talos / page_load_test / jss / object-string-82.html
blob1de01676ef524e3248d3d259a229660c716cf2bc
1 <html><head>
2 <!-- MOZ_INSERT_CONTENT_HOOK -->
3 <script src = runner.js></script>
4 <script>
5 var onlyName = 'toString', onlyNum = 131072;
6 function thisTest() {
8 startTest("object-string");
10 // Try to force real results
11 var ret;
13 // TESTS: String concatenation
15 for ( var num = 500; num <= 4000; num *= 2 ) (function(num){
17 test( "Concat String", num, function(){
18 var str = "";
19 for ( var i = 0; i < num; i++ )
20 str += "a";
21 ret = str;
22 });
24 test( "Concat String Object", num, function(){
25 var str = new String();
26 for ( var i = 0; i < num; i++ )
27 str += "a";
28 ret = str;
29 });
31 test( "Concat String from charCode", num, function(){
32 var str = "";
33 for ( var i = 0; i < num; i++ )
34 str += String.fromCharCode(97);
35 ret = str;
36 });
38 test( "Array String Join", num, function(){
39 var str = [];
40 for ( var i = 0; i < num; i++ )
41 str.push("a");
42 ret = str.join("");
43 });
45 })(num);
47 var str = "", tmp, num = 50;
49 for ( var i = 0; i < 16384; i++ )
50 str += String.fromCharCode( (25 * Math.random()) + 97 );
52 for ( var i = 16384; i <= 131072; i *= 2 ) (function(i){
54 // TESTS: split
56 test( "String Split", i, function(){
57 ret = str.split("");
58 });
60 test( "String Split on Char", i, function(){
61 ret = str.split("a");
62 });
64 // TESTS: characters
66 test( "charAt", i, function(){
67 for ( var j = 0; j < num; j++ ) {
68 ret = str.charAt(0);
69 ret = str.charAt(str.length - 1);
70 ret = str.charAt( 15000 );
71 ret = str.charAt( 12000 );
73 });
75 test( "[Number]", i, function(){
76 for ( var j = 0; j < num; j++ ) {
77 ret = str[0];
78 ret = str[str.length - 1];
79 ret = str[ 15000 ];
80 ret = str[ 12000 ];
82 });
84 test( "charCodeAt", i, function(){
85 for ( var j = 0; j < num; j++ ) {
86 ret = str.charCodeAt(0);
87 ret = str.charCodeAt(str.length - 1);
88 ret = str.charCodeAt( 15000 );
89 ret = str.charCodeAt( 12000 );
91 });
93 // TESTS: indexOf
95 test( "indexOf", i, function(){
96 for ( var j = 0; j < num; j++ ) {
97 ret = str.indexOf("a");
98 ret = str.indexOf("b");
99 ret = str.indexOf("c");
100 ret = str.indexOf("d");
104 test( "lastIndexOf", i, function(){
105 for ( var j = 0; j < num; j++ ) {
106 ret = str.lastIndexOf("a");
107 ret = str.lastIndexOf("b");
108 ret = str.lastIndexOf("c");
109 ret = str.lastIndexOf("d");
113 // TESTS: length
115 test( "length", i, function(){
116 for ( var j = 0; j < num; j++ ) {
117 ret = str.length;
118 ret = str.length;
119 ret = str.length;
120 ret = str.length;
121 ret = str.length;
122 ret = str.length;
126 // TESTS: slice
128 test( "slice", i, function(){
129 for ( var j = 0; j < num; j++ ) {
130 ret = str.slice(0);
131 ret = str.slice(0,5);
132 ret = str.slice(-1);
133 ret = str.slice(-6,-1);
134 ret = str.slice( 15000, 15005 );
135 ret = str.slice( 12000, -1 );
139 // TESTS: substr
141 test( "substr", i, function(){
142 for ( var j = 0; j < num; j++ ) {
143 ret = str.substr(0);
144 ret = str.substr(0,5);
145 ret = str.substr(-1);
146 ret = str.substr(-6,1);
147 ret = str.substr( 15000, 5 );
148 ret = str.substr( 12000, 5 );
152 // TESTS: substring
154 test( "substring", i, function(){
155 for ( var j = 0; j < num; j++ ) {
156 ret = str.substring(0);
157 ret = str.substring(0,5);
158 ret = str.substring(-1);
159 ret = str.substring(-6,-1);
160 ret = str.substring( 15000, 15005 );
161 ret = str.substring( 12000, -1 );
165 // TESTS: toLower/UpperCase
167 test( "toLowerCase", i, function(){
168 for ( var j = 0; j < num; j++ ) {
169 ret = str.toLowerCase();
173 test( "toUpperCase", i, function(){
174 for ( var j = 0; j < num; j++ ) {
175 ret = str.toUpperCase();
179 // TESTS: toSource
181 test( "toSource", i, function(){
182 for ( var j = 0; j < num; j++ ) {
183 ret = str.toSource();
187 // TESTS: toString
189 test( "toString", i, function(){
190 for ( var j = 0; j < num; j++ ) {
191 ret = str.toString();
195 // TESTS: valueOf
197 test( "valueOf", i, function(){
198 for ( var j = 0; j < num; j++ ) {
199 ret = str.valueOf();
203 // TESTS: comparing
205 var tmp = str + "a";
207 test( "comparing", i, function(){
208 for ( var j = 0; j < num; j++ ) {
209 ret = str == tmp;
210 ret = str < tmp;
211 ret = str > tmp;
215 // Double the length of the string
216 str += str;
217 })(i);
219 endTest();
221 </script>
222 <body onload="thisTest()"></body></html>