It seems to be a commonly held belief that a for or while loop should be used instead of the two jQuery alternatives. This belief is based on performance, as jQuery has to invoke additional code to complete the same task.
I tried a number of sources but the best way to find the truth is through experimentation. To create an experiment i use jsper.com as it allows you to run performance tests on snippets of your code, it is particularly useful as the same test can be run from many different browsers.
Having a quick look at jsper.com i found some existing tests, one of interest was Addy Osmani’s revision which had comparative results for for, while and jQuery.each loops. The .each test though seemed to be off by an order of magnitude. What’s missing here is that .each will look for the array of objects in the DOM, performing the same task as var a = $(‘*’).get() which is declared outside of the iteration for all the other test.
This represents an unfair advantage for the other methods, so i created a new revision of the test where the DOM operation was done as part of the test. From this .each is still slower than native methods but only by a small margin.
Using these results it would seem that the advantage of performance is insufficient to force usage of the for or while loop over the jQuery equivalents. Although there may be a saving in performance the jQuery abstraction allows for shorter, more succinct code, using a standard format that is easier to understand.
Common abstractions are useful in software development, if using jQuery i would recommend using jQuery.each and .each rather than a native approach; which should be kept in reserve for applications that require maximum performance.