dataset vs getAttribute (v3)

Revision 3 of this benchmark created by Florian Margaine on


Preparation HTML

<div id="test" data-set="name"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
dataset read
document.getElementById('test').dataset.set
ready
getAttribute
document.getElementById('test').getAttribute('data-set')
ready
dataset write
document.getElementById('test').dataset.set = 'other-name'
ready
setAttribute
document.getElementById('test').setAttribute('data-set', 'other-name')
ready
.attribute read
document.getElementById('test').dataSet
ready
.attribute write
document.getElementById('test').dataSet = 'other-name'
ready

Revisions

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

  • Revision 1: published by Florian Margaine on
  • Revision 2: published on
  • Revision 3: published by Florian Margaine on
  • Revision 4: published by David on
  • Revision 5: published by Yuval Aloni on
  • Revision 6: published on