4 <title>Test Event Handling Performance</title>
5 <script src="benchmark.js"></script>
6 <script src="jquery-basis.js"></script>
7 <script>var old = jQuery.noConflict(true);</script>
8 <script src="../dist/jquery.js"></script>
14 var events = [], num = 400, exec = false;
16 jQuery(document).mousemove(function(e){
21 if ( events.length >= num ) {
23 var s = (new Date).getTime();
25 for ( var n = 0; n < 5; n++ ) {
26 for ( var i = 0; i < num; i++ ) {
27 old.event.handle.call( document, events[i] );
31 var oldNum = (new Date).getTime() - s;
33 s = (new Date).getTime();
35 for ( var n = 0; n < 5; n++ ) {
36 for ( var i = 0; i < num; i++ ) {
37 jQuery.event.handle.call( document, events[i] );
41 var curNum = (new Date).getTime() - s;
43 jQuery("#num").text( old.fn.jquery + ": " + oldNum + " " + jQuery.fn.jquery + ": " + curNum );
45 jQuery(this).unbind( "mousemove", e.handler );
48 events.push( e.originalEvent );
49 jQuery("#num").text( events.length + " / " + num );
55 <p>Move the mouse, please!</p>