stop tests start tests

SlickSpeed

Speed/validity selectors test for Prototype's new selector engine adapter.

Comparing Prototype 1.6.1 with Prototype Legacy indicates the performance cost of the adapter. Both versions share the exact same selector engine. It's built-in for the former, called through an adapter for the latter.

Comparing Prototype Sizzle with Standalone Sizzle also indicates the cost of the adapter abstraction, though the main performance hit should come from the DOM element extension performed by Prototype. It should be particularly felt when running those benchmarks in Internet Explorer < 8.

Under firefox, disable firebug for more accurate results, as most frameworks could throw warnings, slowing down the dom query process.

Tests are run against a local copy of this document.

selectors Prototype 1.6.1Prototype LegacyPrototype NWMatcherPrototype SizzleStandalone Sizzle
body
div
body div
div p
div > p
div + p
div ~ p
div[class^=exa][class$=mple]
div p a
div, p, a
.note
div.example
ul .tocline2
div.example, div.note
#title
h1#title
div #title
ul.toc li.tocline2
ul.toc > li.tocline2
h1#title + div > p
h1[id]:contains(Selectors)
a[href][lang][class]
div[class]
div[class=example]
div[class^=exa]
div[class$=mple]
div[class*=e]
div[class|=dialog]
div[class!=made_up]
div[class~=example]
div:not(.example)
p:contains(selectors)
p:nth-child(even)
p:nth-child(2n)
p:nth-child(odd)
p:nth-child(2n+1)
p:nth-child(n)
p:only-child
p:last-child
p:first-child
final time (less is better) 00000

Legend

the faster the slower exception thrown or zero elements found different returned elements