XHR polling

Benchmark created by j@ubourg on


Description

Speed tests regarding xhr polling.

Preparation HTML

<script>
  var pool = [],
      newXHR = function() {
    return new window.XMLHttpRequest();
      };
  
  if (window.ActiveXObject) {
   newXHR = function() {
    if (window.location.protocol !== "file:") {
     try {
      return new window.XMLHttpRequest();
     } catch (xhrError) {}
    }
  
    try {
     return new window.ActiveXObject("Microsoft.XMLHTTP");
    } catch (activeError) {}
   };
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
No Pooling
var xhr = newXHR();
ready
Pooling
var xhr = pool.pop() || newXHR();
pool.push(xhr);
ready

Revisions

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

  • Revision 1: published by j@ubourg on