1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/public/vendor/jquery/speed/event.html
2014-04-22 18:10:41 +03:00

59 lines
1.2 KiB
HTML

<!doctype html>
<html>
<head>
<title>Test Event Handling Performance</title>
<script src="benchmark.js"></script>
<script src="jquery-basis.js"></script>
<script>var old = jQuery.noConflict(true);</script>
<script src="../dist/jquery.js"></script>
<script>
jQuery(function(){
});
var events = [], num = 400, exec = false;
jQuery(document).mousemove(function(e){
if ( exec ) {
return;
}
if ( events.length >= num ) {
exec = true;
var s = (new Date).getTime();
for ( var n = 0; n < 5; n++ ) {
for ( var i = 0; i < num; i++ ) {
old.event.handle.call( document, events[i] );
}
}
var oldNum = (new Date).getTime() - s;
s = (new Date).getTime();
for ( var n = 0; n < 5; n++ ) {
for ( var i = 0; i < num; i++ ) {
jQuery.event.handle.call( document, events[i] );
}
}
var curNum = (new Date).getTime() - s;
jQuery("#num").text( old.fn.jquery + ": " + oldNum + " " + jQuery.fn.jquery + ": " + curNum );
jQuery(this).unbind( "mousemove", e.handler );
} else {
events.push( e.originalEvent );
jQuery("#num").text( events.length + " / " + num );
}
});
</script>
</head>
<body>
<p>Move the mouse, please!</p>
<p id="num"></p>
</body>
</html>