Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0
Firefox 48
Windows
Other
8 years ago
Test name Executions per second
forEach (Native) 2302.6 Ops/sec
for (Native) 2242.4 Ops/sec
each (jQuery) 2264.7 Ops/sec
For of (ES6) 2332.8 Ops/sec
HTML Preparation code:
AخA
 
1
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
2
<link rel="stylesheet" href="style.min.css" type="text/css">
3
<link rel="stylesheet" href="style.min.css" type="text/css">
4
<link rel="stylesheet" href="style.min.css" type="text/css">
5
<link rel="stylesheet" href="style.min.css" type="text/css">
6
<link rel="stylesheet" href="style.min.css" type="text/css">
Tests:
  • forEach (Native)

     
    var linkEls = document.querySelectorAll('link[href*=".min.css"]');
    [].forEach.call(linkEls,function(el){
      console.log(el);
    });
  • for (Native)

     
    var linkEls = document.querySelectorAll('link[href*=".min.css"]');
    for(var i = 0; i < linkEls.length; i++) {
        var el = linkEls[i];
        console.log(el);
    }
  • each (jQuery)

     
    $('link[href*=".min.css"]').each(function(){
      console.log(this);
    });
  • For of (ES6)

     
    let linkEls = document.querySelectorAll('link[href*=".min.css"]');
    for (var el of linkEls) {
      console.log(el);
    }