Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
style.setProperty vs style.removeProperty vs style.cssPropertyName
(version: 1)
Comparing performance of:
style.setProperty vs style.removeProperty vs style.cssPropertyName
Created:
one year ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<div id="el">Hello world</div>
Script Preparation code:
el = document.getElementById("el") el.style.setProperty('color', 'red') el.style.setProperty('border', '1vmin solid red') el.style.setProperty('padding', '0.5vmin') el.style.setProperty('background-color', 'black') el.style.setProperty('height', '1vh') el.style.setProperty('width', '1vw')
Tests:
style.setProperty
el.style.setProperty('color', '') el.style.setProperty('border', '') el.style.setProperty('padding', '') el.style.setProperty('background-color', '') el.style.setProperty('height', '') el.style.setProperty('width', '')
style.removeProperty
el.style.removeProperty('color') el.style.removeProperty('border') el.style.removeProperty('padding') el.style.removeProperty('background-color') el.style.removeProperty('height') el.style.removeProperty('width')
style.cssPropertyName
el.style.color = '' el.style.border = '' el.style.padding = '' el.style.backgroundColor = '' el.style.height = '' el.style.width = ''
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
style.setProperty
style.removeProperty
style.cssPropertyName
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one month ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Browser/OS:
Chrome 145 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
style.setProperty
1841524.4 Ops/sec
style.removeProperty
2035539.5 Ops/sec
style.cssPropertyName
3187209.2 Ops/sec
Related benchmarks:
6 properties - style.setProperty vs style.cssText vs style vs Object.assign vs setAttribute
6 properties - style.setProperty vs style.cssText vs style vs Object.assign vs setAttribute2
7 properties - style.setProperty vs style.cssText vs style vs Object.assign vs setAttribute
7 properties - style.setProperty vs style.cssText vs style vs Object.assign vs setAttribute.
6 properties - style.setProperty vs style.cssText vs style vs Object.assign vs setAttribute vs assign property
7 properties - style.setProperty vs style.cssText vs style vs Object.assign vs setAttribute vs attributeStyleMap.set
style.setProperty vs style.cssText vs style vs attributeStyleMap.set 3
6 properties - style.setProperty vs style.cssText vs style vs Object.assign vs setAttribute (w/ nullCheck) 2
6 properties - style.setProperty vs style.cssText vs style vs Object.assign vs setAttribute 2
Comments
Confirm delete:
Do you really want to delete benchmark?