SlickSpeed
Valerio Proietti, author of the MooTools JavaScript framework wrote a benchmarking tool called SlickSpeed. This tool runs a number of JavaScript libraries against a suite of CSS selector tests. The source is available from Google Code, I downloaded a copy so I could run tests against the most recent versions of Prototype, MooTools and JQuery against one another.
prototype 1.5.1.1 |
jQuery 1.1.4 |
MooTools r873 (svn) |
MooTools v1.2dev |
|
---|---|---|---|---|
Firefox 2.0.0.6 (Gecko/20070725, Mac) |
210 | 454 | 218 | 243* |
Firefox 2.0.0.6 (Gecko/20070725, Windows XP) |
177 | 339 | 180 | 164* |
Safari 2.0.4 (419.3) |
1385** | 372 | 837 | 727* |
Webkit (AppleWebKit/523.5) |
120 | 185 | 154 | 149 |
iPhone (AppleWebkit/420+ Version 3.0 Mobile/1C28) |
35975 | 13224 | 25594 | 22811 |
Microsoft Internet Explorer 7 (Windows XP) |
969** | 421 | 867 | 811* |
Results are in milliseconds (ms), smaller numbers are better. Asterisks indicate errors returned during the test.
All tests were served and run from a MacBook Pro 2.16 GHz Core Duo, iPhone tests were run on a 1st Generation 8 GB model. Firebug was disabled for the Firefox tests.
A few things which are immediately apparent:
MooTools is a solid performer. Not the fastest and not the slowest, but Valerio Proietti’s code is consistently impressive.
JQuery has gotten significantly faster in the most recent version, John Resig is also writing really good code.
At least as applies to Valerio’s set of selector tests, JQuery is the fastest library on iPhone, nearly twice as fast as MooTools and almost three times faster than Prototype. Joe Hewitt’s iUI project uses Prototype, how much would iPhone performance benefit from switching to JQuery?
The Webkit team is writing some seriously crazy speed optimizations. If they could just get Safari to stop leaking memory we’d be all set (don’t go looking all smug Firefox, you’re standing in a puddle). As it stands now, when Leopard ships Safari will have the fastest JavaScript engine available. The difference between jQuery and Prototype on Webkit and iPhone is surprising, iPhone runs JQuery nearly three times faster than Prototype using the same browser core.
Firefox runs faster in virtualized Windows than it does native on the Mac. Camino (Mac native version of Mozilla/Firefox/Gecko) was slightly faster, but still not as fast as Firefox Windows.
I’ve got one project wrapping up soon which used MooTools and I’ve been very happy with it. Lately I’ve been reading a lot of buzz about JQuery and might be working that into another project. These tests were mostly just done to satisfy my own of curiosity.