remove vs fragment (v3)

Revision 3 of this benchmark created on


Preparation HTML

<div id="content"></div>

Setup

content = document.findElementById("content")
html = ""
for (let i = 0; i < 100; i++) { 
	html += '<div style="width: 10px; height: 10px;"></div>'
}
content.innerHTML = html

Teardown

content.innerHTML = html

Test runner

Ready to run.

Testing in
TestOps/sec
remove
[...document.getElementById("content").children].forEach(item => item.remove())
ready
fragment
new DocumentFragment().append(...document.getElementById("content").children)
ready
range
content = document.getElementById("content")
console.log(content.children)

range = new Range
range.setStart(content, 0)
range.setEnd(content, 100)
range.deleteContents()
ready

Revisions

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