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
<canvas id="canvas1" width="500" height="500"></canvas>
<script>
var can = document.getElementById('canvas1');
var ctx = can.getContext('2d');
ctx.lastFill = '';
ctx.lastFont = '';
function setFill(color) {
ctx.fillStyle = color;
}
function setFillWithCache(color) {
if (ctx.lastFill !== color) {
ctx.fillStyle = color;
ctx.lastFill = color;
}
}
function setFillWithCache2(color) {
if (ctx.fillStyle !== color) {
ctx.fillStyle = color;
}
}
function setFont(font) {
ctx.font = font;
}
function setFontWithCache(font) {
if (ctx.lastFont !== font) {
ctx.font = font;
ctx.lastFont = font;
}
}
function setFontWithCache2(font) {
if (ctx.font !== font) {
ctx.font = font;
}
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
fill |
| ready |
fill cache |
| ready |
fill cache2 |
| ready |
font |
| ready |
font cache |
| ready |
font cache2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.