Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
createElement vs DOMParser
(version: 2)
Comparing performance of:
createElement vs DOMParser
Created:
one year ago
by:
Registered User
Go to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
createElement
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ div = document.createElement("div"); h1 = document.createElement("h1"); h1.replaceChildren("Hello, World!") p = document.createElement("p"); p.replaceChildren("Now is the winter of our discontent."); div.replaceChildren(h1, p);
DOMParser
Document .parseHTMLUnsafe("<div><h1>Hello, World!</h1><p>Now is the summer of our discontent.</p></div>") .body
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
createElement
DOMParser
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser/OS:
Chrome 136 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
createElement
543K/s
DOMParser
77K/s
View exact numbers
Test name
Executions per second
✓
createElement
542,702 Ops/sec
DOMParser
77,250 Ops/sec
Related benchmarks
className vs classList normalization
Splti vs Trim vs replace className
testingqueries
test early return
Multiple .closest() or complex CSS selector
Query Element
Test content attribute vs html element
set: innerHTML vs outerHTML
Nenthe
Comments
Confirm delete:
Do you really want to delete benchmark?