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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
<a> setAttribute
18540294.0 Ops/sec
<a> assignment (=)
12453724.0 Ops/sec
<input> assignment (=)
11558041.0 Ops/sec
<input> setAttribute
15811463.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! 🥺");