Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
createElementNS vs cloneNode
Faster way to create new dom elements before insertion
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:147.0) Gecko/20100101 Firefox/147.0
Browser:
Firefox 147
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 months ago
Test name
Executions per second
createElementNS
16.2 Ops/sec
cloneNode (shallow)
27.9 Ops/sec
cloneNode (deep)
28.0 Ops/sec
Tests:
createElementNS
const list = [] let n = 1e5 while (--n) { const c = document.createElementNS('http://www.w3.org/2000/svg', 'circle') c.setAttribute('cx', 39) c.setAttribute('cy', 0) c.setAttribute('r', 20) list.push(c) }
cloneNode (shallow)
const list = [] let n = 1e5 - 1 const c = document.createElementNS('http://www.w3.org/2000/svg', 'circle') c.setAttribute('cx', 39) c.setAttribute('cy', 0) c.setAttribute('r', 20) list.push(c) while (--n) { list.push(c.cloneNode(false)) }
cloneNode (deep)
const list = [] let n = 1e5 - 1 const c = document.createElementNS('http://www.w3.org/2000/svg', 'circle') c.setAttribute('cx', 39) c.setAttribute('cy', 0) c.setAttribute('r', 20) list.push(c) while (--n) { list.push(c.cloneNode(true)) }