Native XHR vs jQuery ajax (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Native XHR
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
  if (xhr.readyState == 4) {
    //done
  }
}
xhr.open("GET", "http://jsperf.com", true);
xhr.send(null);
ready
jQuery ajax
var request = $.ajax({
  type: "GET",
  url: "http://jsperf.com",
  success: function() {
    // done 
  },
  data: null
});
ready
xhr2
var xhr = new XMLHttpRequest();
xhr.onload = function() {
  //done
}
xhr.open("GET", "http://jsperf.com");
xhr.send(null);
ready

Revisions

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