Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
createElement vs template clone (prefound template)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0
Browser:
Firefox 137
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
createElement
1.1M/s
template
638K/s
View exact numbers
Test name
Executions per second
✓
createElement
1,050,644 Ops/sec
template
638,238 Ops/sec
HTML Preparation code:
<body> <template id="option-template"> <option>Sample Option</option> </template> </body>
Script Preparation code:
window.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';