Bug 449371 Firefox/Thunderbird crashes at exit [@ gdk_display_x11_finalize], p=Brian...
[wine-gecko.git] / testing / performance / talos / page_load_test / jss / real-nsieve-2.html
blobc78218d97ab5a822b6f5ccc71259b52520b302c0
1 <html><head>
2 <!-- MOZ_INSERT_CONTENT_HOOK -->
3 <script src = runner.js></script>
4 <script>
5 var onlyName = 'N-Sieve', onlyNum = 2;
6 function thisTest() {
8 // The Great Computer Language Shootout
9 // http://shootout.alioth.debian.org/
11 // modified by Isaac Gouy
13 function pad(number,width){
14 var s = number.toString();
15 var prefixWidth = width - s.length;
16 if (prefixWidth>0){
17 for (var i=1; i<=prefixWidth; i++) s = " " + s;
19 return s;
22 function nsieve(m, isPrime){
23 var i, k, count;
25 for (i=2; i<=m; i++) { isPrime[i] = true; }
26 count = 0;
28 for (i=2; i<=m; i++){
29 if (isPrime[i]) {
30 for (k=i+i; k<=m; k+=i) isPrime[k] = false;
31 count++;
34 return count;
37 startTest("real-nsieve");
39 for ( var i = 1; i <= 4; i++ ) (function(i){
40 test( "N-Sieve", i, function(){
41 var m = (1<<i)*10000;
42 var flags = Array(m+1);
43 nsieve(m,flags);
44 });
45 })(i);
47 endTest();
49 </script>
50 <body onload="thisTest()"></body></html>