Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
createElement direct V.S. createElement('template') and cloneNode
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/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Browser:
Chrome 143
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
4 months ago
Test name
Executions per second
createElement direct
264869.9 Ops/sec
createElement with template and cloneNode
244135.6 Ops/sec
Script Preparation code:
const contextDirect = '<h1>Hello World</h1><p>Static content</p>' const contentWithClone = '<div id="static"><h1>Hello World</h1><p>Static content</p></div>' // 按vue-vapor复用template dom var t;
Tests:
createElement direct
const div = document.createElement('div'); div.id = 'static'; div.innerHTML = contextDirect;
createElement with template and cloneNode
t = t || document.createElement('template'); t.innerHTML = contentWithClone; const result = t.content.firstChild.cloneNode(true)