Comparaison XML Parsing

Benchmark created on


Setup

const xml = "<company><employee>moi</employee></company>";
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xml, "text/xml");
    

Test runner

Ready to run.

Testing in
TestOps/sec
document.getElementsByTagName

for (let i = 0; i < 1000; i++) {
	let test = xmlDoc.getElementsByTagName('company')[0].getElementsByTagName('employee')[0];
}
ready
document.element
for (let i = 0; i < 1000; i++) {
	let test = xmlDoc.company.employee;
}
ready

Revisions

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