canvas 8bit vs 32bit

JavaScript performance comparison

Test case created by deminoth

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  const canvas = document.createElement('canvas')
  const ctx = canvas.getContext('2d')
  const imageData = ctx.createImageData(1000, 1000)
  const uint8Array = imageData.data
  const dataView = new DataView(uint8Array.buffer)
  

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
8bit
for(let i = 0; i < uint8Array.length; i = i + 4) {
  uint8Array[i] = 128
  uint8Array[i + 1] = 128
  uint8Array[i + 2] = 128
  uint8Array[i + 3] = 255
}
pending…
32bit
for(let i = 0; i < uint8Array.length; i = i + 4) {
  dataView.setUint32(i, 2155905279)
}
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 Comments