jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
When you want clear a canvas, you use clearRect(). But clearRect() use perf.
When you re-define the width or height, the canvas auto-clear it-self. Maybe its better to use that for perf ? (In animation...)
<canvas id="canvas" width="600" height="350">
<script>
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "white";
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
clearRect direct size |
| ready |
re-define width |
| ready |
clearRect |
| ready |
add rect |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.