Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0
Firefox 92
Windows
Desktop
3 years ago
Test name Executions per second
Jquery 7016.4 Ops/sec
Vanilla JS 9586.6 Ops/sec
HTML Preparation code:
x
 
1
<script src='https://code.jquery.com/jquery-3.6.0.min.js'></script>
2
3
<div id='test' data-count="0"></div>
Tests:
  • Jquery

     
    for(let i = 0; i < 10; i++) {
     $('#test').text("actual count value is : "+$('#test').data('count'));
     $('#test').data('count', +$('#test').data('count')+1); 
    }
  • Vanilla JS

     
    for(let i = 0; i < 10; i++) {
      document.querySelector('#test').innerText = "actual count value is : "+document.querySelector('#test').dataset.count;
      document.querySelector('#test').dataset.count = +document.querySelector('#test').dataset.count+1;
    }