Re:Two techniques for massively faster JavaScript
by sachmanb on Monday April 27, 2009 @01:15PM
(#581641)
The newer browsers (Chrome, Firefox 3.5 and such) use JIT JavaScript VMs. For that reason, I think it's not worth investing the effort of avoiding jQuery and going through all this effort for performance gains. It is highly likely that the browsers will optimize these kinds of things at compile time, and these kinds of problems will go away much like contemporary compilers reduced the need to make every string a constant and such (they are made into constants at compile time for you). There's plenty of other performance things to think about, though, but it doesn't seem to be worth it to me to chase this one.
Re:Two techniques for massively faster JavaScript
by bsaunder on Monday April 27, 2009 @02:01PM
(#581743)
You're probably right now. I started down this road in 2006 when the JavaScript VMs weren't there yet with performance. At the time, it was a night and day difference (from don't blink to good-golly-what-are-you-doing). Also, I tend to like the declarative style of templates vs. the imperative style of code for my presentation layer.
Re:Two techniques for massively faster JavaScript
by richcollins on Monday April 27, 2009 @01:27PM
(#581668)
It is if you care about the 70% of people online that use IE. I doubt IEs DOM will be speeding up any time soon.
Re:Two techniques for massively faster JavaScript
by edw519 on Monday April 27, 2009 @12:50PM
(#581590)
I feel the same way but never knew how to say it.
If I need a complex algorithm that will run once a month and someone has already written an open source solution, then sure.
But if I need something that must be efficient and runs thousands of times per day, then maybe I should roll my own.
I guess the formula could be:
WriteYouOwn if DevTimeSaved < (TxnTimeSaved * TxnsPerDay)
I've become a big fan of JST: http://code.google.com/p/trimpath/wiki/JavaScriptTemplates . Send over template snippets as strings and use JST to put them together. With far fewer innerHTML replacements along the way.