Skip to content

Instantly share code, notes, and snippets.

@cvazac
cvazac / gist:f2cd83ea0058246d8e5c
Created May 21, 2015 16:38
performance.clearResourceTimings for SPAs
(function(w){
if (!w || !w.performance) {
return;
}
var clearResourceTimings = performance.clearResourceTimings || performance.webkitClearResourceTimings;
if (clearResourceTimings) {
BOOMR.subscribe("onbeacon", clearResourceTimings);
}
})(window);
@cvazac
cvazac / gist:fe2666834e7f157a1fe7
Last active August 29, 2015 14:21
instrument performance getEntries
;(function(p){
if (!p) return;
function stash(strMethod)
{
p["__orig_" + strMethod] = p[strMethod];
}
stash("getEntries");
stash("webkitClearResourceTimings");
@cvazac
cvazac / gist:cb96774bd62f7eb29f63
Created May 8, 2015 04:48
average response time by domain
;(function(domains)
{
var entries = window.performance.getEntries();
var result = {
total: 0,
count: 0,
domains: {}
};
for (var entry = 0; entry < entries.length; entry++)