Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Chrome 109
Windows
Desktop
6 months ago
Test name Executions per second
dataset 2125874.5 Ops/sec
getAttribute 2695156.2 Ops/sec
HTML Preparation code:
AخA
 
1
<div class="data" data-test="lorem">test dataset</h3>
Tests:
  • dataset

     
    document.querySelector('.data').dataset.test;
  • getAttribute

     
    document.querySelector('.data').getAttribute('test');