Object.assign vs direct object access - Styles (v2)

Revision 2 of this benchmark created on


Preparation HTML

<span id="style-me">Hello</span>

Setup

const element = document.getElementById("style-me");

Test runner

Ready to run.

Testing in
TestOps/sec
Object.assign - styles
Object.assign(element.style, {
   top: "10px",
   padding: "5px 10px"
})
ready
Direct object access - styles
element.style.top = "10px";
element.style.padding = "5px 10px";
ready

Revisions

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