Ajax Get request vs Image prefetch

Benchmark created on


Description

Fastest way to log data to server

Preparation HTML

<script>
  function loadXMLDoc() {
    var xmlhttp;
    if (window.XMLHttpRequest) {
      xmlhttp = new XMLHttpRequest();
    } else {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET", "ajax_info.txt" + new Date().getTime(), true);
    xmlhttp.send();
  }
  
  function loadImage() {
    new Image().src = "ajax_info.txt" + new Date().getTime();
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
ajax get
loadXMLDoc()
ready
image beacon
loadImage()
ready

Revisions

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