The Artima Developer Community
Sponsored Link

Web Buzz Forum
JavaScript on Crack

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Douglas Clifton

Posts: 861
Nickname: dwclifton
Registered: May, 2005

Douglas Clifton is a freelance Web programmer and writer
JavaScript on Crack Posted: Nov 5, 2008 3:14 AM
Reply to this message Reply

This post originated from an RSS feed registered with Web Buzz by Douglas Clifton.
Original Post: JavaScript on Crack
Feed Title: blogZero
Feed URL: http://loadaveragezero.com/app/s9y/index.php?/feeds/index.rss1
Feed Description: Web Development News, Culture and Opinion
Latest Web Buzz Posts
Latest Web Buzz Posts by Douglas Clifton
Latest Posts From blogZero

Advertisement

monitor There used to be a lot of talk about browser wars (both old ones and new), but now days it seems the race is on to see who can develop the fastest JavaScript engine. Not surprising given the explosive growth in front-end development, and JavaScript frameworks and effects libraries. Oh, and a little thing called Ajax. So I spent some time researching and evaluating the current, and future, state of JavaScript implementations and these are my findings.

Evaluation Parameters

Before I get into what's on the horizon, I took the time to evaluate the relative performance of JavaScript in four current browsers. I'll be using the WebKit SunSpider JavaScript benchmarking tool on my Dell XP Pro laptop with the latest Service Packs installed. Internet Explorer is not in the mix because, first of all I can't stand the browser, but mostly because it would likely be crushed by the other competitors—listed below by product, version, vendor, and JavaScript engine:

To level the playing field, each test was performed after a fresh restart with no other foreground applications running. Of the four, Firefox was the most heavily loaded, at least in terms of the number of extensions/plugins installed. I'm not sure if that would have an impact on the results or not. In all cases there were no other tabs open to skew the results (Google mail leaps to mind).

Firefox

mozilla
firefox RESULTS (means and 95% confidence intervals)
-------------------------------------------------
Total:                 6506.0ms +/- 1.1%
-------------------------------------------------

 3d:                    693.6ms +/- 2.0%
   cube:                264.2ms +/- 3.6%
   morph:               200.0ms +/- 2.6%
   raytrace:            229.4ms +/- 1.6%

 access:                997.4ms +/- 1.2%
   binary-trees:        152.2ms +/- 3.0%
   fannkuch:            473.4ms +/- 0.6%
   nbody:               236.8ms +/- 3.3%
   nsieve:              135.0ms +/- 4.5%

 bitops:                789.8ms +/- 3.2%
   3bit-bits-in-byte:   186.4ms +/- 4.5%
   bits-in-byte:        212.0ms +/- 0.6%
   bitwise-and:         151.0ms +/- 0.8%
   nsieve-bits:         240.4ms +/- 7.6%

 controlflow:           166.6ms +/- 6.5%
   recursive:           166.6ms +/- 6.5%

 crypto:                494.8ms +/- 1.7%
   aes:                 174.2ms +/- 1.3%
   md5:                 160.2ms +/- 2.1%
   sha1:                160.4ms +/- 3.1%

 date:                  571.4ms +/- 4.5%
   format-tofte:        357.4ms +/- 6.6%
   format-xparb:        214.0ms +/- 7.8%

 math:                  742.0ms +/- 1.9%
   cordic:              351.2ms +/- 1.8%
   partial-sums:        218.4ms +/- 5.5%
   spectral-norm:       172.4ms +/- 1.1%

 regexp:                508.6ms +/- 7.1%
   dna:                 508.6ms +/- 7.1%

 string:               1541.8ms +/- 0.4%
   base64:              176.4ms +/- 3.5%
   fasta:               381.6ms +/- 1.6%
   tagcloud:            296.0ms +/- 3.4%
   unpack-code:         476.0ms +/- 1.3%
   validate-input:      211.8ms +/- 4.8%

Safari

webkit
safari RESULTS (means and 95% confidence intervals)
-------------------------------------------------
Total:                 6428.2ms +/- 1.1%
-------------------------------------------------

 3d:                    745.0ms +/- 1.9%
   cube:                240.2ms +/- 3.7%
   morph:               258.4ms +/- 3.9%
   raytrace:            246.4ms +/- 2.7%

 access:                977.0ms +/- 2.1%
   binary-trees:        132.0ms +/- 4.2%
   fannkuch:            474.8ms +/- 2.4%
   nbody:               242.2ms +/- 5.6%
   nsieve:              128.0ms +/- 8.1%

 bitops:                782.8ms +/- 2.1%
   3bit-bits-in-byte:   120.0ms +/- 0.0%
   bits-in-byte:        176.0ms +/- 3.9%
   bitwise-and:         292.4ms +/- 3.6%
   nsieve-bits:         194.4ms +/- 3.6%

 controlflow:           154.2ms +/- 4.3%
   recursive:           154.2ms +/- 4.3%

 crypto:                442.8ms +/- 3.0%
   aes:                 164.2ms +/- 6.7%
   md5:                 136.2ms +/- 5.2%
   sha1:                142.4ms +/- 4.2%

 date:                  624.8ms +/- 1.1%
   format-tofte:        262.0ms +/- 2.1%
   format-xparb:        362.8ms +/- 1.6%

 math:                  811.4ms +/- 2.9%
   cordic:              322.6ms +/- 3.3%
   partial-sums:        330.2ms +/- 4.5%
   spectral-norm:       158.6ms +/- 3.8%

 regexp:                520.8ms +/- 0.1%
   dna:                 520.8ms +/- 0.1%

 string:               1369.4ms +/- 6.9%
   base64:              184.0ms +/- 3.7%
   fasta:               328.2ms +/- 3.1%
   tagcloud:            314.4ms +/- 30.2%
   unpack-code:         268.6ms +/- 4.0%
   validate-input:      274.2ms +/- 2.4%

Chrome

chrome
chrome RESULTS (means and 95% confidence intervals)
-------------------------------------------------
Total:                2697.4ms +/- 2.6%
-------------------------------------------------
 3d:                   237.8ms +/- 12.9%
   cube:                53.8ms +/- 9.3%
   morph:              120.6ms +/- 24.5%
   raytrace:            63.4ms +/- 3.0%

 access:               154.6ms +/- 6.0%
   binary-trees:        10.8ms +/- 18.9%
   fannkuch:            54.4ms +/- 3.5%
   nbody:               54.0ms +/- 9.4%
   nsieve:              35.4ms +/- 7.7%

 bitops:               119.8ms +/- 5.6%
   3bit-bits-in-byte:    9.8ms +/- 5.7%
   bits-in-byte:        18.8ms +/- 7.2%
   bitwise-and:         37.4ms +/- 3.8%
   nsieve-bits:         53.8ms +/- 11.1%

 controlflow:            6.8ms +/- 8.2%
   recursive:            6.8ms +/- 8.2%

 crypto:                96.8ms +/- 4.4%
   aes:                 33.8ms +/- 9.9%
   md5:                 32.4ms +/- 3.4%
   sha1:                30.6ms +/- 2.2%

 date:                 621.6ms +/- 2.7%
   format-tofte:       264.8ms +/- 6.5%
   format-xparb:       356.8ms +/- 1.8%

 math:                 198.4ms +/- 5.3%
   cordic:             105.2ms +/- 10.6%
   partial-sums:        67.2ms +/- 5.1%
   spectral-norm:       26.0ms +/- 3.4%

 regexp:               547.4ms +/- 1.7%
   dna:                547.4ms +/- 1.7%

 string:               714.2ms +/- 2.2%
   base64:              73.0ms +/- 13.6%
   fasta:               99.8ms +/- 2.8%
   tagcloud:           188.0ms +/- 3.7%
   unpack-code:        246.0ms +/- 1.2%
   validate-input:     107.4ms +/- 3.0%

Opera

opera
opera RESULTS (means and 95% confidence intervals)
-------------------------------------------------
Total:                 7536.2ms +/- 1.2%
-------------------------------------------------
 3d:                    815.6ms +/- 2.7%
   cube:                254.4ms +/- 2.5%
   morph:               302.6ms +/- 5.5%
   raytrace:            258.6ms +/- 2.3%

 access:               1160.4ms +/- 0.8%
   binary-trees:         82.4ms +/- 7.3%
   fannkuch:            568.8ms +/- 1.0%
   nbody:               314.6ms +/- 1.9%
   nsieve:              194.6ms +/- 3.5%

 bitops:                987.2ms +/- 10.8%
   3bit-bits-in-byte:   116.2ms +/- 5.6%
   bits-in-byte:        238.2ms +/- 44.3%
   bitwise-and:         378.6ms +/- 1.4%
   nsieve-bits:         254.2ms +/- 2.6%

 controlflow:            98.2ms +/- 10.3%
   recursive:            98.2ms +/- 10.3%

 crypto:                454.6ms +/- 2.8%
   aes:                 214.2ms +/- 5.5%
   md5:                 120.2ms +/- 0.5%
   sha1:                120.2ms +/- 0.5%

 date:                  551.0ms +/- 2.9%
   format-tofte:        290.6ms +/- 5.3%
   format-xparb:        260.4ms +/- 0.3%

 math:                  638.6ms +/- 3.1%
   cordic:              278.2ms +/- 5.8%
   partial-sums:        206.2ms +/- 3.4%
   spectral-norm:       154.2ms +/- 4.3%

 regexp:                871.6ms +/- 2.5%
   dna:                 871.6ms +/- 2.5%

 string:               1959.0ms +/- 1.0%
   base64:              200.4ms +/- 0.3%
   fasta:               392.6ms +/- 1.3%
   tagcloud:            390.6ms +/- 2.4%
   unpack-code:         765.0ms +/- 0.9%
   validate-input:      210.4ms +/- 4.2%

Findings

Ranked from fastest to slowest overall:

  • Chrome — 2697.4ms
  • Safari — 6428.2ms
  • Firefox — 6506.0ms
  • Opera — 7536.2ms

Now I'm not a statistician, but Safari and Firefox yielded very similar results in the middle ground, while Chrome was the clear winner with Opera at the bottom (surprising, given the browser's reputation for performance). SunSpider has a nice feature that allows you to compare two result sets. The difference from fastest to slowest was a staggering 279% speed increase in Chrome over Opera. Of course a lot depends on what you're using JavaScript for, hence the breakdown into categories and different operations within those categories. If you enjoy pouring over raw data, by all means have at it.

On the Horizon

Over the past several months we've seen all manner of announcements and articles about JavaScript performance improvements and what to expect when this research and development makes its way into the mainstream. We've learned about trace trees, JIT compilers, direct-threaded, bytecode optimizers, and so on. Mozilla, for example, plans to roll out it's TraceMonkey engine with the release of Firefox 3.1. For the impatient, you can grab a copy of the 3.1 nightly builds and enable TraceMonkey now if you want to play with it or do your own testing. One can only speculate on how Google and Opera will respond to these latest developments.

Related Reading

Read: JavaScript on Crack

Topic: LugRadio Live and Unleashed UK 2008 live show now available Previous Topic   Next Topic Topic: Shinmun, a small and beautiful blog engine

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use