Categories
josephscott

Too Much Of A Good Thing, JavaScripts Loops In Prototype

Ryan Campbell investigates the cost of enumerable loops in Prototype. The resulting numbers are pretty dramatic when dealing with larger arrays. One thing to keep in mind though is that for only a few iterations over arrays with a small number of elements then the penalty is probably small enough that it won’t cause problems.

Benchmarks using the various JavaScript libraries is something that I’d expect to see more of. Soon or later someone will post benchmarks between Prototype, YUI and JQuery on various tests. The benefit from having numbers like this is that eventually all libraries will adopt the fastest approach that meets their goals.