Native XHR vs jQuery ajax (v12)

Revision 12 of this benchmark created on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js">
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
xhr2
// async test
var xhr = new XMLHttpRequest();
xhr.onload = function() {
  deferred.resolve();
}
xhr.open("GET", "https://jsonplaceholder.herokuapp.com/posts/1");
xhr.send(null);
ready
jQuery ajax
// async test
var request = $.ajax({
  type: "GET",
  url: "https://jsonplaceholder.herokuapp.com/posts/1",
  success: function() {
    deferred.resolve();
  },
  data: null
});
ready
Native XHR
// async test
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
  if (xhr.readyState == 4) {
    deferred.resolve();
  }
}
xhr.open("GET", "https://jsonplaceholder.herokuapp.com/posts/1", true);
xhr.send(null);
ready

Revisions

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