Last active
August 29, 2015 14:04
-
-
Save purplecabbage/812fa5bb8e58ee258f8d to your computer and use it in GitHub Desktop.
Revisions
-
purplecabbage revised this gist
Jul 17, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,4 +22,4 @@ document.addEventListener('deviceready',function() { console.log("average = " + (total / maxSamples)); window.localStorage.perfLog = JSON.stringify([]); } }); -
purplecabbage revised this gist
Jul 17, 2014 . 1 changed file with 23 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,25 @@ document.addEventListener('deviceready',function() { var deltaT = +new Date() - window.performance.timing.navigationStart; var perfLog = window.localStorage.perfLog ? JSON.parse(window.localStorage.perfLog) : []; perfLog.push(deltaT); window.localStorage.perfLog = JSON.stringify(perfLog); var maxSamples = 100; if (perfLog.length < maxSamples) { window.location.reload(); } else { perfLog.sort(function (a, b) { return (( a < b ) ? -1 : (( a > b ) ? 1 : 0 )); }); console.log("min = " + perfLog[0]); console.log("max = " + perfLog[maxSamples-1]); var total = 0; for (var n = 0; n < maxSamples; n++) { total += perfLog[n]; } console.log("average = " + (total / maxSamples)); window.localStorage.perfLog = JSON.stringify([]); } } -
purplecabbage created this gist
Jul 17, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ var deltaT = +new Date() - window.performance.timing.navigationStart; var perfLog = window.localStorage.perfLog ? JSON.parse(window.localStorage.perfLog) : []; perfLog.push(deltaT); window.localStorage.perfLog = JSON.stringify(perfLog); var maxSamples = 100; if (perfLog.length < maxSamples) { window.location.reload(); } else { perfLog.sort(function (a, b) { return (( a < b ) ? -1 : (( a > b ) ? 1 : 0 )); }); console.log("min = " + perfLog[0]); console.log("max = " + perfLog[maxSamples-1]); var total = 0; for (var n = 0; n < maxSamples; n++) { total += perfLog[n]; } console.log("average = " + (total / maxSamples)); window.localStorage.perfLog = JSON.stringify([]); }