setAttribute(...) vs. classList.add(...) vs classList.value vs className (multiple classes, no override) (version: 0)
Same as https://www.measurethat.net/Benchmarks/Show/27015/0/setattribute-vs-classlistadd-vs-classlistvalue-vs-class but without override, getter chosen based on https://www.measurethat.net/Benchmarks/Show/27014/0/getattribute-vs-classlistvalue-vs-classname
Comparing performance of: setAttribute(...) vs classList.add vs classList.value vs className
Memory measurements supported only in Chrome.
For precise memory measurements Chrome must be launched with --enable-precise-memory-info flag.
More information: Monitoring JavaScript Memory
Test case name
Result
setAttribute(...)
classList.add
classList.value
className
Fastest:N/A
Slowest:N/A
Latest run results:
Run details: (Test run date:
3 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0