Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Chrome 130
Mac OS X 10.15.7
Desktop
one month ago
Test name Executions per second
img 19934520.0 Ops/sec
canvas 19775930.0 Ops/sec
bitmap 19971804.0 Ops/sec
Script Preparation code:
x
 
var canvas = document.createElement('canvas')
var context = canvas.getContext('2d')
var bitmap
var img = new Image()
img.onload = async () => {
    canvas.width = img.width
    canvas.height = img.height
    context.drawImage(img, 0, 0)
    bitmap = await createImageBitmap(img)
}
img.src = 'https://neurostof.nl/ns/letters.jpg'
var c = document.createElement('canvas').getContext('2d')
// bitmap && c.drawImage(img,    250, 250, 250, 250, 0, 0, 1000, 1000)
// bitmap && c.drawImage(canvas, 250, 250, 250, 250, 0, 0, 1000, 1000)
// bitmap && c.drawImage(bitmap, 250, 250, 250, 250, 0, 0, 1000, 1000)
Tests:
  • img

     
    bitmap && c.drawImage(img,    250, 250, 250, 250, 0, 0, 1000, 1000)
  • canvas

     
    bitmap && c.drawImage(canvas, 250, 250, 250, 250, 0, 0, 1000, 1000)
  • bitmap

     
    bitmap && c.drawImage(bitmap, 250, 250, 250, 250, 0, 0, 1000, 1000)