HTML Preparation code:
AخA
 
1
<div id="foo" data-bar="bar"></div>
Tests:
  • object entry

     
    const element = document.getElementById("foo");
    const ob = {};
    ob.data = element.dataset.bar;
    var i = 2000;
    while (i--) {
        console.log(ob.data);
    }
  • dataset

     
    const element = document.getElementById("foo");
    var i = 2000;
    while (i--) {
        console.log(element.dataset.bar);
    }
  • variable

     
    const element = document.getElementById("foo");
    const bar = element.dataset.bar;
    var i = 2000;
    while (i--) {
        console.log(bar);
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    object entry
    dataset
    variable

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Chrome 85 on Linux
View result in a separate tab
Test name Executions per second
object entry 44.6 Ops/sec
dataset 41.0 Ops/sec
variable 44.0 Ops/sec