JavaScript Performance Benchmark (in Samsung Nexus, Google Chrome Beta) This web page is a simple benchmark for JavaScript analogous to (and directly comparable with) Squeak's tinyBenchmarks. It reports results in terms of operations/sec (simple things like addition and subscripting) and sends/sec (user-defined message to a user-defined object). n1 = 2; time = 7 milliseconds; 142857143 operations/sec. n2 = 24; time = 9 milliseconds; 8336111 sends/sec. Am 12.02.2012 18:10 schrieb "Jerry Bell" <[hidden email]>:
Hello, |
Very impressive!
I tried the benchmark on my PC under Chrome, and ended up with about 4x the performance of my original test. So I guess Chrome's Javascript engine is quite a bit better than IE's! Did you try executing the benchmark from within Amber? I would be interested to know if you have the same expreience with "dynamic" code speed vs. code loaded from a package. I duplicated my experiment under Chrome: After loading my simple test package and running it in a workspace, my results were very close to running the javascript benchmark directly. I then renamed my test method, and ran the renamed version in a workspace - resulting in about 1/4 of the speed. -Jerry |
=========
Firefox 9 http://www.weather-dimensions.com/Dan/JavaScriptBenchmark.html ========= JavaScript Performance Benchmark n1 = 2; time = 2 milliseconds; 500000000 operations/sec. n1 = 4; time = 2 milliseconds; 1000000000 operations/sec. n1 = 8; time = 4 milliseconds; 1000000000 operations/sec. n1 = 16; time = 8 milliseconds; 1000000000 operations/sec. n1 = 32; time = 13 milliseconds; 1230769231 operations/sec. n1 = 64; time = 16 milliseconds; 2000000000 operations/sec. n1 = 128; time = 32 milliseconds; 2000000000 operations/sec. n1 = 256; time = 64 milliseconds; 2000000000 operations/sec. n1 = 512; time = 131 milliseconds; 1954198473 operations/sec. n1 = 1024; time = 277 milliseconds; 1848375451 operations/sec. n1 = 2048; time = 544 milliseconds; 1882352941 operations/sec. n2 = 24; time = 2 milliseconds; 37512500 sends/sec. n2 = 25; time = 3 milliseconds; 40464333 sends/sec. n2 = 26; time = 5 milliseconds; 39283600 sends/sec. n2 = 27; time = 8 milliseconds; 39726375 sends/sec. n2 = 28; time = 13 milliseconds; 39556077 sends/sec. n2 = 29; time = 21 milliseconds; 39620952 sends/sec. n2 = 30; time = 34 milliseconds; 39596147 sends/sec. n2 = 31; time = 54 milliseconds; 40339056 sends/sec. n2 = 32; time = 88 milliseconds; 40052023 sends/sec. n2 = 33; time = 143 milliseconds; 39880329 sends/sec. n2 = 34; time = 229 milliseconds; 40294607 sends/sec. n2 = 35; time = 371 milliseconds; 40243536 sends/sec. n2 = 36; time = 599 milliseconds; 40330245 sends/sec. -------------------------------- Firefox 10 -------------------------------- Firefox 10 (came out in January) n1 = 2; time = 3 milliseconds; 333333333 operations/sec. n1 = 4; time = 2 milliseconds; 1000000000 operations/sec. n1 = 8; time = 4 milliseconds; 1000000000 operations/sec. n1 = 16; time = 7 milliseconds; 1142857143 operations/sec. n1 = 32; time = 15 milliseconds; 1066666667 operations/sec. n1 = 64; time = 30 milliseconds; 1066666667 operations/sec. n1 = 128; time = 60 milliseconds; 1066666667 operations/sec. n1 = 256; time = 64 milliseconds; 2000000000 operations/sec. n1 = 512; time = 128 milliseconds; 2000000000 operations/sec. n1 = 1024; time = 287 milliseconds; 1783972125 operations/sec. n1 = 2048; time = 553 milliseconds; 1851717902 operations/sec. n2 = 24; time = 4 milliseconds; 18756250 sends/sec. n2 = 25; time = 3 milliseconds; 40464333 sends/sec. n2 = 26; time = 5 milliseconds; 39283600 sends/sec. n2 = 27; time = 7 milliseconds; 45401571 sends/sec. n2 = 28; time = 13 milliseconds; 39556077 sends/sec. n2 = 29; time = 19 milliseconds; 43791579 sends/sec. n2 = 30; time = 32 milliseconds; 42070906 sends/sec. n2 = 31; time = 51 milliseconds; 42711941 sends/sec. n2 = 32; time = 83 milliseconds; 42464795 sends/sec. n2 = 33; time = 133 milliseconds; 42878850 sends/sec. n2 = 34; time = 217 milliseconds; 42522880 sends/sec. n2 = 35; time = 348 milliseconds; 42903310 sends/sec. n2 = 36; time = 563 milliseconds; 42909089 sends/sec. No big difference in this test between Firefox 9 and 10 on just the benchmark http://www.weather-dimensions.com/Dan/JavaScriptBenchmark.html /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// I wanted to evaluate the code from within Amber I put the code into < > brackets and exchanged " by ' and change <BR> to just BR. I seemed to compile but no output. Could you please post your version of the JavaScript benchmark code which works in Amber? Hannes P.S. This is what I used < // A simple prime-finder dominated by arithmetic, logic and subscripting // (Originally due to Trygve Reenskaug) var opBenchmark = function (nReps) { var size = 8190; var count; for(var iter= 0; iter<nReps; iter++) { count = 0; flags = new Array(size); for(var i=0; i<size; i++) flags[i]= true; for(var i=1; i<=size; i++) { if(flags[i-1]) { var prime = i+1; var k = i + prime; while(k <= size) { flags[k-1] = false; k = k + prime; } count = count + 1; }}} return count; } var msDiff = function (t1, t0) { return ((t1.getSeconds()*1000) + t1.getMilliseconds()) - ((t0.getSeconds()*1000) + t0.getMilliseconds()); } // A user-defined object with a user-defined message (the Fibonacci function) function Fibber(x) {this.x= x;} Fibber.prototype.fib= function(i) { if(i<2) return 1; return this.fib(i-1) + this.fib(i-2); } // Now we run them and report results var tinyBenchmarks = function () { var t0, t1, n1, n2, result, time; // First the integer ops benchmark... n1= 1; do {n1= n1*2; t0= new Date(); result= opBenchmark(n1); t1= new Date(); var time1= msDiff(t1, t0); document.write("n1 = " + n1 + "; time = " + time1 + " milliseconds; " + ((n1 * 500000 * 1000) / time1).toFixed(0) + " operations/sec. BR"); } while (time1 < 500); document.write('........................................................'); // Then the message send benchmark n2= 23; do {n2= n2+1; t0= new Date(); result= (new Fibber(1)).fib(n2); t1= new Date(); var time2= msDiff(t1, t0); document.write('n2 = ' + n2 + '; time = ' + time2 + ' milliseconds; ' + (((result * 1000) / time2)).toFixed(0) + ' sends/sec. BR'); } while (time2 < 500); } tinyBenchmarks(); > On 2/13/12, Jerry Bell <[hidden email]> wrote: > Very impressive! > > I tried the benchmark on my PC under Chrome, and ended up with about > 4x the performance of my original test. So I guess Chrome's > Javascript engine is quite a bit better than IE's! > > Did you try executing the benchmark from within Amber? I would be > interested to know if you have the same expreience with "dynamic" code > speed vs. code loaded from a package. I duplicated my experiment > under Chrome: After loading my simple test package and running it in > a workspace, my results were very close to running the javascript > benchmark directly. I then renamed my test method, and ran the > renamed version in a workspace - resulting in about 1/4 of the speed. > > -Jerry > |
Free forum by Nabble | Edit this page |