1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 21:00:23 +01:00

DOMRect test: made performance measurement cumulative

This commit is contained in:
kkapsner 2019-05-11 13:17:16 +02:00
parent 587bd5bca8
commit 9fd454eb03

View File

@ -83,6 +83,8 @@
output.querySelector(".refresh").addEventListener("click", performTest);
output.querySelector(".performance").addEventListener("click", function(){
let count = 200;
let totalCount = 0;
let totalDuration = 0;
return function(){
let duration = 0;
let i = 0;
@ -109,10 +111,12 @@
);
}
}
totalCount += count;
totalDuration += duration;
alert(
(count / (duration / 1000)).toFixed(2) + " tests/s\n" +
(duration * 1000 / count).toFixed(2) + " µs/test\n" +
"(" + count + " samples)"
(totalCount / (totalDuration / 1000)).toFixed(2) + " tests/s\n" +
(totalDuration * 1000 / totalCount).toFixed(2) + " µs/test\n" +
"(" + totalCount + " samples)"
);
};
}());