Native XHR vs jQuery ajax (v15)

Revision 15 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) {
    alert(xhr);
    //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(data) {
    alert(data);
  },
  data: null
});
ready
Native XHR onload
var xhr = new XMLHttpRequest();
xhr.onload = function(data) {
    alert(data);
  };
xhr.open("GET", "http://jsperf.com", true);
xhr.send(null);
ready

Revisions

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