Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
canvas drawing images
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0
Browser:
Firefox 133
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
draw image directly
2257.1 Ops/sec
draw imageData
46.8 Ops/sec
draw image blob
2090.0 Ops/sec
HTML Preparation code:
<canvas></canvas>
Script Preparation code:
'use strict' let image, imageData, ctx = new OffscreenCanvas(0, 0).getContext('2d'), main = document.querySelector('canvas'), c = main.getContext('2d'), width, height, imageAsBlob, imageAsBitmap async function globalMeasureThatScriptPrepareFunction() { image = await loadImage(); ({ width, height } = image) ctx.canvas.width = main.width = width ctx.canvas.height = main.height = height ctx.drawImage(image, 0, 0, width, height) imageData = ctx.getImageData(0, 0, width, height) imageAsBlob = await loadImage(URL.createObjectURL(await ctx.canvas.convertToBlob())) } function loadImage(url = `https://www.measurethat.net/images/Picture1.png`) { return new Promise(resolve => { const img = new Image img.src = url img.onload = () => resolve(img) }) } function clear() { c.clearRect(0, 0, width, height) } const repeatCount = 40 function test(num) { switch (num) { case 1: for (let n = repeatCount; n--;) { c.drawImage(image, 0, 0, width, height) clear() } break case 2: for (let n = repeatCount; n--;) { c.putImageData(imageData, 0, 0,) clear() } break case 3: for (let n = repeatCount; n--;) { c.drawImage(imageAsBlob, 0, 0) clear() } break } }
Tests:
draw image directly
test(1)
draw imageData
test(2)
draw image blob
test(3)