Test name | Executions per second |
---|---|
Jquery | 7016.4 Ops/sec |
Vanilla JS | 9586.6 Ops/sec |
<script src='https://code.jquery.com/jquery-3.6.0.min.js'></script>
<div id='test' data-count="0"></div>
for(let i = 0; i < 10; i++) {
$('#test').text("actual count value is : "+$('#test').data('count'));
$('#test').data('count', +$('#test').data('count')+1);
}
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;
}