textContent vs replaceChildren

Benchmark created on


Setup

const a = document.createElement('div')

Test runner

Ready to run.

Testing in
TestOps/sec
textContent
a.append(
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div')
)
a.textContent = ''
ready
replaceChildren
a.append(
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div'),
document.createElement('div')
)
a.replaceChildren()
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.