Created
September 28, 2017 07:49
-
-
Save klinkby/774c1422ff6289fdcd4b1f3528f2a024 to your computer and use it in GitHub Desktop.
Collect key performance metrics, dump in document then reload page for another run.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
"use strict"; | |
var t = performance.timing, | |
t1 = t.navigationStart, | |
arr = [t.responseEnd - t1, t.domContentLoadedEventStart - t1, t.loadEventEnd - t1], | |
storage = sessionStorage, | |
storageKey = "perf-coll", | |
coll = JSON.parse(storage.getItem(storageKey) || "[]"), | |
serialized; | |
coll.push(arr); | |
serialized = JSON.stringify(coll) | |
storage.setItem(storageKey, serialized); | |
document.body.textContent = serialized; | |
console.info(coll.length); | |
setTimeout(function () { | |
location.reload(); | |
}, 2000); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment