Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
setAttribute vs assignment (=)
setAttribute vs assignment (=)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:134.0) Gecko/20100101 Firefox/134.0
Browser:
Firefox 134
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
<a> setAttribute
20204682.0 Ops/sec
<a> assignment (=)
17826408.0 Ops/sec
<input> assignment (=)
13144319.0 Ops/sec
<input> setAttribute
20485802.0 Ops/sec
Script Preparation code:
var anchor = document.createElement("a"); var input = document.createElement("input");
Tests:
<a> setAttribute
anchor.setAttribute("href", "https://localhost/");
<a> assignment (=)
anchor.href = "https://localhost/";
<input> assignment (=)
input.value = "Hello! 🥺";
<input> setAttribute
input.setAttribute("value", "Hello! 🥺");