Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36
Chrome 88
Windows
Desktop
3 years ago
Test name Executions per second
Jquery 12810.8 Ops/sec
Vanilla JS 15443.0 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;
    }