dataset vs getAttribute

JavaScript performance comparison

Revision 13 of this test case created by

Preparation code

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

Preparation code output

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

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
dataset read
document.getElementById('test').dataset.set
pending…
getAttribute
document.getElementById('test').getAttribute('data-set')
pending…
dataset write
document.getElementById('test').dataset.set = 'other-name'
pending…
setAttribute
document.getElementById('test').setAttribute('data-set', 'other-name')
pending…
getAttribute nondata
document.getElementById('test').getAttribute('nondata-set')
pending…
setAttribute nondata
document.getElementById('test').setAttribute('nondata-set', 'other-name')
pending…
dataset nondata
document.getElementById('test').dataset
pending…

Compare results of other browsers

Revisions

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

0 Comments