Today is a good day to code

Which JavaScript Framework is the Fastest

Posted: April 8th, 2009 | Author: | Filed under: JavaScript, Programming | Tags: , , , , , | No Comments »

I have been wondering for a while which JavaScript framework is the fastest. I was thinking about writing some sort of test to try to determine which one had the best speed, but I have found one that seems to work. Mootools SlickSpeed Test is a good start.

It seems to focus on DOM manipulation / access / iteration speed, rather than testing the functionality built into the frameworks. I suppose that it would be tough since each framework offers different things. When I ran the test, Prototype 1.6.0.2 was the slowest, YUI 2.5.2 was the next slowest, MooTools 1.2 was next up from the bottom, JQuery 1.2.6 was the second fastest, and Dojo 1.1.1 was the fastest by a wide margin in Safari 4 beta, albeit with some errors.

In Google chrome 2.n beta, the results were as follows:

  1. JQuery 1.2.6
  2. MooTools 1.2
  3. Dojo 1.1.1
  4. YUI 2.5.2
  5. Prototype 1.6.0.2

In Firefox 3.0.6

  1. MooTools 1.2
  2. JQuery 1.2.6
  3. Prototype 1.6.0.2
  4. Dojo 1.1.1
  5. YUI 2.5.2

In IE 8 ( Wow IE 8 is slow )

  1. Dojo 1.1.1 ( many errors disqualified )
  2. JQuery 1.2.6
  3. YUI 2.5.2 ( a few errors )
  4. MooTools 1.2
  5. Prototype 1.6.0.2

iPhone Safari ( DNF / Could not run / Simulator)

  1. JQuery 1.2.6
  2. MooTools 1.2
  3. Dojo 1.1.1
  4. Prototype 1.6.0.2
  5. YUI 2.5.2

Android Browser

  1. JQuery 1.2.6
  2. MooTools 1.2
  3. Dojo 1.1.1
  4. Prototype 1.6.0.2
  5. YUI 2.5.2 ( Big Suprise )

What is interesting about these tests is that in general it seems that you should use JQuery if your development pattern involves heavy selector use. I still prefer Prototype because of the programming features that I get with it, even if the selector part is slow. IE 8 breaks a lot of the frameworks. Prototype and JQuery hold up the best it seems. I haven’t really looked at MooTools however.

On mobile devices, you should think long and hard about using any framework that involves added overhead since the devices are really slow. It seems that Dojo supports the built in Safari functions for dom navigation or something. It was wicked fast in Safari 4, but had a few errors. Overall JQuery is probably the best. I guess I’ll have to take a look at it, though reluctantly. I still need to write a test to check iterator performance though.