Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
jQuery vs pure JS : html
innerHTML vs html
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Browser:
Chrome 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
jQuery
8401.5 Ops/sec
pure JS
16769.6 Ops/sec
HTML Preparation code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Script Preparation code:
var frag = document.createDocumentFragment(); for (var i=0; i<100; i++){ var inDiv = document.createElement('span'); inDiv.id="s_"+i; inDiv.innerHTML = 'bla'; inDiv.className = 'myclass'; frag.appendChild(inDiv); } document.body.appendChild(frag);
Tests:
jQuery
$('span.myclass').each(function () { $(this).html('x'); });
pure JS
$('span.myclass').each(function () { this.innerHTML = 'y'; });