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 Pixel Manipulation (v62) Revision 62 of this benchmark created on April 4, 2013 Description Tests three different methods of manipulating pixels using the canvas.
Preparation HTML <canvas id ="canvas" height ="256" width ="256" > </canvas >
Setup var canvas = document .getElementById ('canvas' );
var canvasWidth = canvas.width ;
var canvasHeight = canvas.height ;
var ctx = canvas.getContext ('2d' );
var imageData = ctx.getImageData (0 , 0 , canvasWidth, canvasHeight);
var data = imageData.data ;
var buf = new ArrayBuffer (imageData.data .length );
var buf8 = new Uint 8ClampedArray(buf);
var data32 = new Uint 32Array (buf);
Teardown
ctx.putImageData (imageData, 0 , 0 );
Test runner Ready to run.
Run Quick Run Testing in Test Ops/sec 8-bit Pixel Manipulation for (var y = 0 ; y < canvasHeight; ++y) {
for (var x = 0 ; x < canvasWidth; ++x) {
var index = (y * canvasWidth + x) * 4 ;
var value = x * y & 0xff ;
data[index] = value;
data[++index] = value;
data[++index] = value;
data[++index] = 255 ;
}
}
ready
32-bit Pixel Manipulation for (var y = 0 ; y < canvasHeight; ++y) {
for (var x = 0 ; x < canvasWidth; ++x) {
var value = x * y & 0xff ;
data32[y * canvasWidth + x] =
(255 << 24 ) |
(value << 16 ) |
(value << 8 ) |
value;
}
}
imageData.data .set (buf8);
ready
8-bit Pixel Manipulation+ for (var y = 0 ; y < canvasHeight; ++y) {
for (var x = 0 ; x < canvasWidth; ++x) {
var index = (y * canvasWidth + x) * 4 ;
var value = x * y & 0xff ;
data[index] = value;
data[index+1 ] = value;
data[index+2 ] = value;
data[index+3 ] = 255 ;
}
}
ready
Revisions You can edit these tests or add more tests to this page by appending /edit to the URL.
Revision 1 : published by Andrew J. Baker on December 1, 2011 Revision 3 : published on December 1, 2011 Revision 4 : published on December 2, 2011 Revision 5 : published by PlayMyCode on December 2, 2011 Revision 6 : published by Andrew J. Baker on December 2, 2011 Revision 7 : published on December 2, 2011 Revision 8 : published by PlayMyCode on December 2, 2011 Revision 9 : published by PlayMyCode on December 4, 2011 Revision 10 : published by PlayMyCode on December 4, 2011 Revision 11 : published on December 8, 2011 Revision 18 : published on January 5, 2012 Revision 19 : published by Arkanciscan on January 25, 2012 Revision 23 : published on March 19, 2012 Revision 24 : published on March 28, 2012 Revision 27 : published by imaya on May 21, 2012 Revision 28 : published on May 30, 2012 Revision 29 : published by ard on June 12, 2012 Revision 30 : published on June 20, 2012 Revision 34 : published on August 22, 2012 Revision 35 : published on August 31, 2012 Revision 37 : published by PAEz on October 4, 2012 Revision 41 : published on November 3, 2012 Revision 42 : published on November 3, 2012 Revision 43 : published on November 12, 2012 Revision 44 : published on November 12, 2012 Revision 47 : published by Autarc on November 24, 2012 Revision 48 : published on November 27, 2012 Revision 49 : published by Dan H on December 15, 2012 Revision 50 : published on January 9, 2013 Revision 53 : published by Russell Chapman on January 18, 2013 Revision 54 : published on January 25, 2013 Revision 56 : published by HotSix on January 30, 2013 Revision 57 : published by Andymensional on January 30, 2013 Revision 62 : published on April 4, 2013 Revision 63 : published on April 4, 2013 Revision 64 : published on April 4, 2013 Revision 65 : published on April 4, 2013 Revision 66 : published on April 4, 2013 Revision 67 : published on April 6, 2013 Revision 68 : published on April 11, 2013 Revision 69 : published on April 18, 2013 Revision 72 : published by orwellophile on May 15, 2013 Revision 75 : published on June 12, 2013 Revision 76 : published by Ghetolay on July 2, 2013 Revision 78 : published on August 1, 2013 Revision 79 : published on August 28, 2013 Revision 80 : published on August 28, 2013 Revision 81 : published on September 22, 2013 Revision 82 : published on November 11, 2013 Revision 83 : published on November 11, 2013 Revision 84 : published on November 15, 2013 Revision 85 : published on November 20, 2013 Revision 86 : published by mattdesl on December 8, 2013 Revision 87 : published by mattdesl on December 8, 2013 Revision 88 : published by mattdesl on December 9, 2013 Revision 90 : published by mattdesl on December 28, 2013 Revision 91 : published on January 12, 2014 Revision 92 : published on January 14, 2014 Revision 93 : published on February 25, 2014 Revision 95 : published on March 25, 2014 Revision 96 : published on March 25, 2014 Revision 97 : published on March 29, 2014 Revision 98 : published on April 3, 2014 Revision 99 : published on April 5, 2014 Revision 100 : published on June 4, 2014 Revision 101 : published on June 4, 2014 Revision 102 : published on June 5, 2014 Revision 103 : published on August 5, 2014 Revision 104 : published on August 7, 2014 Revision 106 : published on August 26, 2014 Revision 107 : published on September 27, 2014 Revision 109 : published on October 17, 2014 Revision 110 : published on October 17, 2014 Revision 111 : published on October 18, 2014 Revision 112 : published on October 23, 2014 Revision 113 : published on November 5, 2014 Revision 116 : published by ass on December 5, 2014 Revision 117 : published by ass on December 5, 2014 Revision 118 : published by ass on December 5, 2014 Revision 123 : published on December 10, 2014 Revision 124 : published on December 10, 2014 Revision 125 : published by Al on December 12, 2014 Revision 128 : published by ап on January 8, 2015 Revision 129 : published by ап on January 9, 2015 Revision 131 : published by ziomio on February 8, 2015 Revision 132 : published on February 13, 2015 Revision 136 : published by CircleGuy on April 18, 2015 Revision 137 : published on June 2, 2015 Revision 138 : published on June 2, 2015 Revision 139 : published on June 2, 2015 Revision 140 : published by cast to uint8 on June 12, 2015 Revision 141 : published on September 1, 2015 Revision 142 : published on September 6, 2015 Revision 144 : published by Carter on October 7, 2015 Revision 148 : published on October 17, 2015 Revision 149 : published on October 21, 2015 Revision 150 : published by Nam on November 6, 2015 Revision 151 : published on December 23, 2015 Revision 160 : published on January 18, 2016 Revision 161 : published by pierre lepers on January 18, 2016 Revision 162 : published by pierre lepers on January 18, 2016 Revision 163 : published by pierre lepers on January 18, 2016 Revision 164 : published on January 19, 2016 Revision 165 : published on January 22, 2016 Revision 166 : published on February 13, 2016 Revision 167 : published by Chadnaut on February 16, 2016 Revision 168 : published by Chadnaut on February 17, 2016 Revision 171 : published by julian libor on March 13, 2019