Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Chrome 123
Windows
Desktop
2 years ago
Benchmark.js
fillRect with a constant color string
2K/s
fillRect with a template literal color string
1K/s
fillRect using a concatenated color string
1K/s
fillRect using a joined color string
1K/s
Using drawImage to copy a pixel from a palette canvas
1K/s
putImageData() using a 1px by 1px ImageData instance
103/s
View exact numbers
Test name Executions per second
fillRect with a constant color string 2,266 Ops/sec
fillRect with a template literal color string 1,200 Ops/sec
fillRect using a concatenated color string 1,200 Ops/sec
fillRect using a joined color string 1,153 Ops/sec
Using drawImage to copy a pixel from a palette canvas 1,016 Ops/sec
putImageData() using a 1px by 1px ImageData instance 103 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: