style.setProperty vs style.cssText vs style vs attributeStyleMap.setFastest: style.cssText (3.1x faster)
37 ops/sec
35 ops/sec
33 ops/sec
12 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| style.setProperty | |
| style.cssText | |
| style | |
| attributeStyleMap.set |
| Test name | Executions per second |
|---|---|
| ✓ style.cssText | 42 Ops/sec |
| style.setProperty | 38 Ops/sec |
| style | 37 Ops/sec |
| attributeStyleMap.set | 12 Ops/sec |