Hey all, Some of you may have seen on reddit that John Resig (of jQuery) is working on a new, ultra-fast, css selector module. It is called Sizzle and although it is not released yet, John uploaded a version to github: http://github.com/jeresig/sizzle/tree/master
MochiKit's Selector module (which is ported from early versions of Prototype) is unbearably slow, and thus many people steer clear of it. I asked John about the possibility of including Sizzle in MochiKit and he's ok with that, Sizzle will be released under the MIT license. I did a quick test, just deleted most of the Selector module and replaced with John's code, and modified the exported functions of the Selector module to use that instead. The "MochiKit.Selector.Selector" object has to go though, so this would not be an entirely backwards-compatible change. The functions findChildElements, findDocElements and $$ would be unchanged though. You can check out the speed test (included with Sizzle) where I've added both the trunk version of MochiKit and the MochiKit+Sizzle fusion here: http://www.hvergi.net/arnar/public/sizzle/speed/# For this benchmark, regular MochiKit completed all tests in 3983 milliseconds. The MochiKit+Sizzle combination does it in 61. That means we are talking about a speedup by a factor of roughly 65! It doesn't come without faults though. Sizzle didn't support all queries in MochiKit's unit tests, namely these are the ones that fail (I'm cc-ing John in case he wants to add support for any of them): a[fakeattribute] - i.e. checking for presence of attribute p[lang|="en"] - membership test of hyphen-seperated string collections :nth-of-type(...) pseudo-class :enabled, :disabled and :checked pseudo-classes :root pseudo-class This change would increase the size of the packed version by about 1700 bytes (currently at 173.5 KB). Now, how do people feel about committing a change like this to the trunk? Of course, we'd wait until a fairly stable version of Sizzle is released. John told us that Sizzle will become the main selector engine behind jQuery, but will also remain a standalone component. All bugfixes will be backported to Sizzle also. As long as MochiKit keeps up, this means we'd benefit from the bugs reported by the jQuery community. A rough test, just plomping in the Sizzle source code into Selector.js is available on my website: http://www.hvergi.net/arnar/public/mochikit/MochiKit/Selector.js cheers, Arnar --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~----------~----~----~----~------~----~------~--~---
