Native XHR vs jQuery ajax (v19)

Revision 19 of this benchmark created by kalle on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="https://raw.githubusercontent.com/github/fetch/master/fetch.js"></script>

Setup

function done(data) {
      alert(data);
  }
  var url = 'https://www.yandex.ru/portal/home-touch/service-worker.js';

Test runner

Ready to run.

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

Revisions

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