JQuery each loops and performance

In a project where I am one of the developers we had JavaScript code that was really slow. I started to analyze the code and I found out that we had a lot of jQuery each loops in the code. I thought that they could be a big part of the performance issue. I tried to replace all jQuery each loops with classic JavaScript for loops. After I replaced all loops the code was running on a few milliseconds instead of a few seconds. In must cases you will not se a boost like this, but we hade several nested loops and handled pretty big amount of data.

$(items).each(index,item)
{
      DoStuff(item);
}

was replaced with:

 
for(var index = 0; index < items.length; index++)
{
      var item = items[index];
      DoStuff(item);
}

The conclusion is that JQuery each loops could be a big performance thief and it better to use a classic JavaScript for loop.