Peppy CSS3 JavaScript Selector Races Past The Competition
Thursday, October 23rd, 2008James Donaghue has just released Peppy, a very fast CSS3 compliant JavaScript selector engine. The author claims that it is …
… faster1 than all other major JavaScript libraries with DOM querying capabilities (Prototype 1.6.0.3, JQuery 1.2.6, MooTools 1.2.1, EXT 2.2, DoJo 1.2.0, YUI 2.6.0). It is faster2 than Sizzle by John Resig and it also is cross browser (IE included). Take a look for yourselves, I have a profiling page set up here.
The compressed library only goes up to 10K, which makes it an ideal replacement for bulkier libraries if only for its DOM capabilities. Sizzle author John Resig has however identified three potential issues in Ajaxian’s news entry:
Three big problems that I see:
- He indiscriminately caches in all browsers - including IE - but *never* invalidates the cache. Since the DOM mutation events don’t fire in Internet Explorer all queries will forever be cached and not update on a requery. This is very, very, bad and will break lots of applications.
- He copied parts of Sizzle and integrated them into his code without including the original copyright notice (in fact, it appears to have no license information, at all).
- Where’s the test suite? How do you know that it “works in IE”? Sizzle is currently being run against the MochiKit and jQuery test suites so you can be sure in knowing that the code quality will stand up.
The future of Peppy looks bright, but will it will stand up to Sizzle and other tested libraries in terms of reliability? I sure hope so.
1 (MajorLibraries - excluding Sizzle) : 4x faster in FF3, 6x faster in FF2,
8x faster in IE7, 3x faster in IE6, 3x faster in Opera 9, 4x faster in Safari 3
2 (results compared to Sizzle): 1.2x faster in FF3, 1.3x faster in FF2,
11.1x faster in IE7, 4.5x faster in IE6, 0x faster in Opera 9, 4x faster in Safari 3
