Benchmark: Prototype and jQuery

Claudio Cicali thought it might be fun to test wether the common prejudices against jQuery / for prototype hold:
  • Prototype CSS Selector is good
  • jQuery CSS Selector is evil
After all jQuery has a reallygood potential of becoming one of the nig players on the library market. Its ever expanding list of plugins already contains many desirable features. He set up some tests
  • select elements by a type selector (html element). Element selected (1000 times)
  • select elements by a type selector (html element). No element selected (1000 times)
  • select elements by a simple class selector. The class name does not exist (5000 times)
  • select elements by a simple class selector. The class name does exist (5000 times)
  • select elements by a simple id selector. The id does not exist (5000 times)
  • select elements by a simple id selector. The id does exist (5000 times)
  • select elements by a descendant selector (no elements selected) (1000 times)
  • select elements by a descendant selector (20 elements selected) (1000 times)
  • select 20 elements by a id selector and bind an event handler to each one (100 times)
  • select 20 elements by a class selector and add an addictional class name to each one (1000 times)
and ran them with both Libraries and tada, he got some interesting results:
The white/green representation may be a bit misleading, on some domains jQuery leases prototype far behind while in others the difference isn’t that big.
Did you like this? Share it: