jQuery Cache / No-Cache (v3)

Revision 3 of this benchmark created by Benny Bennet on


Description

Comparasion between jQuery (with or without caching) and vanillaJS

Preparation HTML

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

<div id="test">HELLO</div>

Setup

var domEl = document.getElementById('test');

Test runner

Ready to run.

Testing in
TestOps/sec
Cache
var $el = $(domEl);
$el.width('100px');
$el.width('200px');
$el.width('300px');
$el.width('400px');
$el.width('500px');
$el.width('600px');
ready
No-Cache
$(domEl).width('100px');
$(domEl).width('200px');
$(domEl).width('300px');
$(domEl).width('400px');
$(domEl).width('500px');
$(domEl).width('600px');
ready
noJquery
domEl.style.width = '100px';
domEl.style.width = '200px';
domEl.style.width = '300px';
domEl.style.width = '400px';
domEl.style.width = '500px';
domEl.style.width = '600px';
ready
noJquery setAttribute
domEl.setAttribute('style', 'width: 100px');
domEl.setAttribute('style', 'width: 200px');
domEl.setAttribute('style', 'width: 300px');
domEl.setAttribute('style', 'width: 400px');
domEl.setAttribute('style', 'width: 500px');
domEl.setAttribute('style', 'width: 600px');
ready

Revisions

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