Skip to content

Instantly share code, notes, and snippets.

@lindsayevans
Created August 23, 2010 07:21
Show Gist options
  • Save lindsayevans/544993 to your computer and use it in GitHub Desktop.
Save lindsayevans/544993 to your computer and use it in GitHub Desktop.
Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.36 Safari/534.3
Timing 100000 iterations of dollar_data, el_data...
el_data: 4.104s @ 24808/s (n=101813, x=1921, b=0.037ms, w=0.073ms, a=0.040ms)
dollar_data: 1.375s @ 77825/s (n=107010, x=10701, b=0.009ms, w=0.025ms, a=0.013ms)
Rate el_data dollar_data
el_data 24808/s -- -68%
dollar_data 77825/s 214% --
Tests duration: 5.479 seconds.
Total duration: 6.095 seconds.
Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)
Timing 100000 iterations of dollar_data, el_data...
el_data: 13.460s @ 7449/s (n=100264, x=604, b=0.113ms, w=0.548ms, a=0.134ms)
dollar_data: 2.316s @ 43433/s (n=100590, x=4790, b=0.019ms, w=0.075ms, a=0.023ms)
Rate el_data dollar_data
el_data 7449/s -- -83%
dollar_data 43433/s 483% --
Tests duration: 15.776 seconds.
Total duration: 17.483 seconds.
Browser: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timing 100000 iterations of dollar_data, el_data...
el_data: 26.938s @ 3715/s (n=100082, x=307, b=0.202ms, w=0.407ms, a=0.269ms)
dollar_data: 6.125s @ 16449/s (n=100750, x=1625, b=0.039ms, w=0.087ms, a=0.061ms)
Rate el_data dollar_data
el_data 3715/s -- -77%
dollar_data 16449/s 343% --
Tests duration: 33.063 seconds.
Total duration: 35.515 seconds.
Browser: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4
Timing 100000 iterations of dollar_data, el_data...
el_data: 5.156s @ 19773/s (n=101949, x=1999, b=0.047ms, w=0.063ms, a=0.051ms)
dollar_data: 1.694s @ 60678/s (n=102788, x=7342, b=0.013ms, w=0.039ms, a=0.016ms)
Rate el_data dollar_data
el_data 19773/s -- -67%
dollar_data 60678/s 207% --
Tests duration: 6.850 seconds.
Total duration: 7.458 seconds.
Browser: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
Timing 100000 iterations of dollar_data, el_data...
el_data: 18.502s @ 5420/s (n=100275, x=573, b=0.157ms, w=0.691ms, a=0.185ms)
dollar_data: 3.205s @ 31309/s (n=100345, x=2867, b=0.029ms, w=0.110ms, a=0.032ms)
Rate el_data dollar_data
el_data 5420/s -- -83%
dollar_data 31309/s 478% --
Tests duration: 21.707 seconds.
Total duration: 23.320 seconds.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery data() benchmarking</title>
</head>
<body>
<div id="test-element"></div>
<script src="jquery-1.4.2.min.js"></script>
<!-- http://gfx.neohub.com/benchmark/benchmark.js -->
<script src="benchmark.js"></script>
<!-- http://gfx.neohub.com/benchmark/benchmark_perlish.js -->
<script src="benchmark_perlish.js"></script>
<script>
$(function(){
new Benchmark({
el_data: function(){
var el = $('#test-element'), k = 'k-'+(Math.random()*1000), v = 'v-'+(Math.random()*1000);
el.data(k, v);
},
dollar_data: function(){
var el = $('#test-element'), k = 'k-'+(Math.random()*1000), v = 'v-'+(Math.random()*1000);
$.data(el, k, v);
}
},{
iterations: 100000,
responders: 'Perlish'
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment