Browser Diet jQuery vs Javascript Performance Test (v2)

Revision 2 of this benchmark created by Dan Mathisen on


Description

We'll modify an element's text and then change a couple CSS properties.

Preparation HTML

<div id="text">Let's change this text</div>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
$('#text').html('The text is changed').css({
        backgroundColor: 'red',
        color: 'yellow'
});
ready
Javascript
var text = document.getElementById('text');
text.innerHTML = 'The text is changed';
text.style.backgroundColor = 'red';
text.style.color = 'yellow';
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.