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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
<a> setAttribute
13469871.0 Ops/sec
<a> assignment (=)
17236540.0 Ops/sec
<input> assignment (=)
14954874.0 Ops/sec
<input> setAttribute
13238756.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! 🥺");