Monday, September 29, 2008

Flash, Silverlight and JavaScript Performance

Here is an interesting head to head performance comparison of Flash and Silverlight:

http://www.itwriting.com/primetest/index.html


 

Both grind thru a less than optimal algorithm for finding a bunch of prime numbers.

Code is provided in another link so that you can see that it is apples to apples in terms of the code implemented.


 

On my machine, I saw an over two one advantage for Silverlight. Silverlight ran 1M prime checks in .8892285 seconds and Flash took 2.153 seconds for the same. This ratio held up over a range of values:


 

Number

Flash

Silverlight

Ratio

1 M

2.153

0.8892285

2.42119995

2 M

5.477

2.3092736

2.371741486

3 M

9.627

4.056832

2.373033934

4 M

14.324

6.0697226

2.359910155

5 M

19.692

8.3445947

2.359850982

6 M

25.895

10.802571

2.397114539

7 M

31.773

13.3872827

2.373371857

8 M

38.599

16.1520106

2.389733449

9 M

45.238

19.0887398

2.369878812


 

Another individual, Tobin Harris no doubt, has provided a JavaScript implementation at:

http://www.tobinharris.com/primes.html


 

It took 54 seconds for the 1M to run in JavaScript. But this result had to be thrown out because IE was constantly popping up a dialog asking if the JavaScript should be terminated. Although that is a lesson in and of itself that JavaScript running loose in the browser will face ever increasing scrutiny that diminishes it's usefulness.


 

No comments: