mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-08 20:54:49 +01:00
DOMRect test: made performance measurement cumulative
This commit is contained in:
parent
587bd5bca8
commit
9fd454eb03
@ -83,6 +83,8 @@
|
|||||||
output.querySelector(".refresh").addEventListener("click", performTest);
|
output.querySelector(".refresh").addEventListener("click", performTest);
|
||||||
output.querySelector(".performance").addEventListener("click", function(){
|
output.querySelector(".performance").addEventListener("click", function(){
|
||||||
let count = 200;
|
let count = 200;
|
||||||
|
let totalCount = 0;
|
||||||
|
let totalDuration = 0;
|
||||||
return function(){
|
return function(){
|
||||||
let duration = 0;
|
let duration = 0;
|
||||||
let i = 0;
|
let i = 0;
|
||||||
@ -109,10 +111,12 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
totalCount += count;
|
||||||
|
totalDuration += duration;
|
||||||
alert(
|
alert(
|
||||||
(count / (duration / 1000)).toFixed(2) + " tests/s\n" +
|
(totalCount / (totalDuration / 1000)).toFixed(2) + " tests/s\n" +
|
||||||
(duration * 1000 / count).toFixed(2) + " µs/test\n" +
|
(totalDuration * 1000 / totalCount).toFixed(2) + " µs/test\n" +
|
||||||
"(" + count + " samples)"
|
"(" + totalCount + " samples)"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user