DOM vs object (v4)

Revision 4 of this benchmark created on


Preparation HTML

<div id="el"></div>
<script>
  var el = document.getElementById('el');
  var obj = {
   foo: 'bar'
  };
  
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
DOM
document.getElementById('el').foo = 'bar';
ready
DOM (cached)
el.foo = 'bar';
ready
Object
obj.foo = 'bar';
ready
dataset
el.dataset = obj;
ready

Revisions

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