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
<div id="wrap">
<div>
<div>
<canvas id="canvas" width="300" height="300"></canvas>
</div>
</div>
</div>
var wrap = document.getElementById( 'wrap' );
var canvas = document.getElementById( 'canvas' );
var firstRunA = true;
var firstRunB = true;
function setShadow( isSet, style, shadow, radius ) {
if ( isSet ) {
style['boxShadow'] = shadow;
style['WebkitBoxShadow'] = shadow;
style['MozBoxShadow'] = shadow;
style['borderRadius'] = radius;
style['WebkitBorderRadius'] = radius;
style['MozBorderRadius'] = radius;
return true;
} else {
return false;
}
}
function fillCanvas( canvas ) {
var SIZE = 10,
ctx = canvas.getContext( '2d' ),
w = canvas.width,
h = canvas.height;
ctx.clearRect( 0, 0, w, h );
for ( var x = 0; x < w; x += SIZE ) {
for ( var y = 0; y < h; y += SIZE ) {
var r = (x) % 255,
g = (y*7) % 255,
b = (x*y) % 255;
ctx.fillStyle = 'rgb( ' + r + ',' + g + ',' + b + ')';
ctx.fillRect( x, y, SIZE, SIZE );
}
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
no shadow |
| ready |
box-shadow |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.