Is RightJS really faster than jQuery?
debuggable.com
debuggable.com
Despite the work being done for node, I wanted to see how it looked on the various browser engines, so I made a pasted together set of screenshots [1] showing the underscore benchmark suite running in Chrome, Firefox 3.5, and a recent Minefield nightly. Results are paired underscore before my tweaks and after.
[1] http://gr.ayre.st/s/images/underscore_perf_benches.gif
I believe the methods all have the same signatures and are operating on the same set of data. jQuery has the disadvantage here of having to work on a variety of interpreters where I only care about v8. The interesting bit is to note the jQuery.map() call on the newer tracemonkey is FASTER than using my for loop. It all depends on what the interpreter can optimize and hitting those paths. I have notes [2] on my optimizations if you're interested in how the various approaches bench on node. I was going for low hanging fruit, so these were done with a simple timing function on the node repl.
[2] http://wiki.github.com/grayrest/underscore/node-conversion-i...
As far as getting faster than jQuery goes, I agree with what you're saying. What is difficult is getting faster in a "meaningful" way - everything else seems like a waste of time to me.
I've been working on building a library like Narwhal's. This fork of underscore is my util.js equivalent.
What you can learn though, is that using the built in DOM methods, or wrapping createElement if you need to, is far faster than using some other abstraction from the DOM.
Second, I wasn't arguing against libraries -- I was saying that the difference in performance is probably not what you want to use to decide which library to use.
You'd certainly manipulate hundreds of DOM elements at a time, consider say a twitter stream, where each post has "10 seconds ago" marker, and they all need updating.
Author of RightJS thank you for your time and keep up the good work.