basket.js versus browser cache

JavaScript performance comparison

Revision 6 of this test case created by

Preparation code

<script src="https://github.com/addyosmani/basket.js/blob/gh-pages/dist/basket.full.min.js">
</script>
      
<script>
Benchmark.prototype.setup = function() {
  // Warm the cache
  // A random URL from a CORS enabled data source
  var url = "http://code.jquery.com/jquery.js";
  
  basket.require({
    url: url,
    key: "jquery"
  });

};

Benchmark.prototype.teardown = function() {
  basket.clear();
  var scripts = document.getElementsByTagName("script");
  for (var i = 0; i < scripts.length; i++) {
    var script = scripts[i];
    if (script.defer || script.src === url) {
      script.parentElement.removeChild(script);
    }
  }

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
basket.js
// async test
basket.require({
  url: url,
  key: "jquery"
}).then(function() {
  deferred.resolve();
});
pending…
Browser cache
// async test
var script = document.createElement("script");
script.addEventListener("load", function() {
  deferred.resolve();
});
script.src = url;
document.head.appendChild(script);
pending…

Compare results of other browsers

Revisions

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

0 Comments