angular.element vs document.querySelector (v5)

Revision 5 of this benchmark created by Jibap on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
<div ng-app>
    <div id="col1" ng-controller="MyCtrl" class="group1"></div>
</div>

Setup

var MyCtrl;
    
    function FindWithAngular() {
      return angular.element('.group1');
    }
    
    function FindWithJS() {
      return document.querySelector('.group1')
    }

Test runner

Ready to run.

Testing in
TestOps/sec
angular.element
var g = FindWithAngular();
ready
document.querySelector
var g = FindWithJS();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.