Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
createElement vs template clone
(version: 0)
Comparing performance of:
createElement vs template
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<body> <template id="option-template"> <option>Sample Option</option> </template> </body>
Script Preparation code:
const template = document.getElementById('option-template');
Tests:
createElement
const option = document.createElement('option'); option.id = `option-${i}`; option.setAttribute('data-foo', 'bar'); option.selected = true; option.textContent = 'aaaa';
template
const clonedOption = template.content.firstElementChild.cloneNode(true); clonedOption.id = `option-${i}`; clonedOption.setAttribute('data-foo', 'bar'); clonedOption.selected = true; clonedOption.textContent = 'aaaa';
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
createElement
template
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?