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 50 points single stroke vs multiple (v39) Revision 39 of this benchmark created on February 20, 2015 Description Compares drawing a simple shape out of multiple lines compared to one polyline.
Preparation HTML <canvas id ="c" width ="640" height ="480" >
</canvas >
<script >
var canvas = document .getElementById ('c' );
var context = canvas.getContext ('2d' );
var points = [];
var generateRandomPoints = function (points, amount ) {
for (var i = amount - 1 ; i > 0 ; i--) {
var x = Math .floor (Math .random () * 100 );
var y = Math .floor (Math .random () * 100 );
points[i] = {
x : x,
y : y
};
}
};
generateRandomPoints (points, 50 );
context.strokeStyle = 'black' ;
</script >
Setup context.clearRect (0 , 0 , canvas.width , canvas.height );
Test runner Ready to run.
Run Quick Run Testing in Test Ops/sec multiple lines for (var i = points.length - 1 ; i > 1 ; i--) {
var p = points[i];
var p1 = points[i - 1 ];
context.beginPath ();
context.moveTo (p.x , p.y );
context.lineTo (p1.x , p1.y );
context.stroke ();
}
ready
one polyline context.beginPath ();
for (var i = points.length - 1 ; i > 1 ; i--) {
var p = points[i];
var p1 = points[i - 1 ];
context.moveTo (p.x , p.y );
context.lineTo (p1.x , p1.y );
}
context.stroke ();
ready
Revisions You can edit these tests or add more tests to this page by appending /edit to the URL.
Revision 1 : published by Boris on August 1, 2011 Revision 2 : published by Boris on August 2, 2011 Revision 4 : published on October 22, 2011 Revision 5 : published by William R. J. Ribeiro on December 1, 2011 Revision 6 : published on July 20, 2012 Revision 7 : published on July 20, 2012 Revision 8 : published on July 20, 2012 Revision 9 : published on December 22, 2012 Revision 11 : published on April 22, 2013 Revision 12 : published on June 14, 2013 Revision 16 : published on August 27, 2013 Revision 17 : published on November 7, 2013 Revision 18 : published on January 27, 2014 Revision 19 : published on January 29, 2014 Revision 20 : published on January 29, 2014 Revision 21 : published on January 29, 2014 Revision 22 : published on January 29, 2014 Revision 23 : published on February 5, 2014 Revision 24 : published on February 7, 2014 Revision 25 : published by bcd on February 8, 2014 Revision 26 : published on March 7, 2014 Revision 27 : published on March 18, 2014 Revision 28 : published on March 18, 2014 Revision 29 : published on March 18, 2014 Revision 32 : published on March 18, 2014 Revision 34 : published on April 4, 2014 Revision 35 : published on July 5, 2014 Revision 37 : published on July 23, 2014 Revision 39 : published on February 20, 2015 Revision 40 : published on February 20, 2015 Revision 41 : published on February 20, 2015 Revision 42 : published on February 24, 2015 Revision 43 : published on February 24, 2015 Revision 46 : published on January 12, 2016