localStorage versus browser cache (v11)

Revision 11 of this benchmark created on


Description

Is it quicker to retrieve a javascript file from localStorage than it is to let the browser fetch a cached copy from its own cache?

Setup

// A random URL from a CORS enabled data source
    var url = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js";
    
    // This can be synchronous for testing purposes
    var xhr = new XMLHttpRequest();
    xhr.open("GET", url, false);
    xhr.send();
    if (xhr.status === 200) {
      localStorage.test = xhr.responseText;
    }

Teardown


    delete localStorage.test;
  

Test runner

Ready to run.

Testing in
TestOps/sec
localStorage
var jquery = localStorage.test;
ready
Browser cache
xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
xhr.send();
ready

Revisions

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