Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Chrome 126
Mac OS X 10.15.7
Desktop
2 years ago
Benchmark.js
fillRect with a constant color string
2K/s
fillRect using a concatenated color string
895/s
fillRect using a joined color string
867/s
fillRect with a template literal color string
851/s
Using drawImage to copy a pixel from a palette canvas
387/s
putImageData() using a 1px by 1px ImageData instance
30/s
View exact numbers
Test name Executions per second
fillRect with a constant color string 1,875 Ops/sec
fillRect using a concatenated color string 895 Ops/sec
fillRect using a joined color string 867 Ops/sec
fillRect with a template literal color string 851 Ops/sec
Using drawImage to copy a pixel from a palette canvas 387 Ops/sec
putImageData() using a 1px by 1px ImageData instance 30 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: