Clear only vs Save transform Clear restore vs Canvas w with memo vs w=w vs w+=0 vs fillRect vs createImageDataFastest: Save transform Clear restore (754.3x faster)
142,011 ops/sec
85,456 ops/sec
8,773 ops/sec
8,705 ops/sec
3,393 ops/sec
3,151 ops/sec
188 ops/sec
Fastest: Clear only (2556.3x faster)
1,042,131 ops/sec
623,678 ops/sec
564,702 ops/sec
524,731 ops/sec
473,716 ops/sec
2,702 ops/sec
408 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Clear only | |
| Save transform Clear restore | |
| Canvas w with memo | |
| w=w | |
| w+=0 | |
| fillRect | |
| createImageData |
| Test name | Executions per second |
|---|---|
| ✓ Clear only | 818,270 Ops/sec |
| Save transform Clear restore | 545,847 Ops/sec |
| fillRect | 537,595 Ops/sec |
| w=w | 502,957 Ops/sec |
| w+=0 | 484,405 Ops/sec |
| Canvas w with memo | 8,338 Ops/sec |
| createImageData | 349 Ops/sec |