Posts

Showing posts with the label fast

The Fastest Date toJSON and fromJSON?

I know yesterday post supposed to be the last 'till the the end of the month but I could not resits. Dustin Diaz twitted anyone trying to parse our wonky rails dates in JS. do this: var date = Date.parse(str.replace(/( \+)/, ' UTC$1')); seems to fix it. Again, I could not resist to create a toUTCString based function to create JSON strings and to parse them back. This is the result and apparently is both the fastest implementation I know and cross browser (Chrome, Firefox, Inernet Explorer, Safari). This is a quick post so if you find some problem please let me know, thanks. (function(){ // WebReflection Fast Date.prototype.toJSON and Date.fromJSON Suggestion var rd = /^.{5}(\d{1,2}).(.{3}).(.{4}).(.{2}).(.{2}).(.{2}).+$/, rs = /^(.{4}).(.{2}).(.{2}).(.{2}).(.{2}).(.{2}).+$/, d = new Date, f = /(GMT|UTC)$/.exec(d.toUTCString())[1], // cheers gazheyes m = {}, i = 0, s = "" ; d.setUTCDate(1); while(i < 12){ d.setUTCMonth(i)...

The Fastest Selector Engine For FireFox 3.0 ?

Image
I am putting some effort to make vice-versa project a good, production ready, alternative against common libraries, and since these days I am working hard with XML, XSL(T), and XPath I decided to try an experiment implementing CSS to XPath translator for FireFox 3.0 With version 3.1 we will have querySelector and querySelectorAll but version 3.0 is still the most used one, FireFox speaking! The nightly build of vice-versa introduces a new file, mainly used for personal experiments via vice-versa library and the first experiment is an improved document.query for those browsers with document.evaluate support without document.querySelectorAll . Unfortunately Internet Explorer SlickSpeed Selector Speed Test comparing latest version of each library such Dojo , DOMAssistant , Sizzle (congrats for the new site!), Sly , and finally vice-versa project. Here the summary, from faster to slower: vice-versa 760ms Dojo 1.3.1 868ms (2 tests failed) DOMAssistant 880ms (good stuff Robert!)...