createElement vs constructor

Benchmark created on


Setup

if (!window.MyCustomElement) {
	window.MyCustomElement = class extends HTMLElement {
		
	}
	
	customElements.define("my-custom-element", MyCustomElement);
}

Test runner

Ready to run.

Testing in
TestOps/sec
createElement
document.createElement("my-custom-element");
ready
constructor
new MyCustomElement();
ready
unknown element
document.createElement("unknown-element");
ready

Revisions

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