dataset vs getAttribute (v6)

Revision 6 of this benchmark created on


Preparation HTML

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

Setup

var test = document.getElementById('test');

Test runner

Ready to run.

Testing in
TestOps/sec
read: dataset
test.dataset.set
ready
read: getAttribute
test.getAttribute('data-set')
ready
read: .attribute
test.dataSet
ready
read: [attribute]
test['dataSet']
ready
write: dataset
test.dataset.set = 'other-name'
ready
write: setAttribute
test.setAttribute('data-set', 'other-name')
ready
write: .attribute
test.dataSet = 'other-name'
ready
write: [attribute]
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