Bug Tracker

Opened 12 years ago

Closed 12 years ago

#2565 closed enhancement (fixed)

event.fix performance tweaks patch

Reported by: diego Owned by:
Priority: major Milestone: 1.2.4
Component: event Version: 1.2.3
Keywords: Cc:
Blocked by: Blocking:

Description

Using lazy function definition it is possible to optimize quite consistently the performances of the event.fix() method.

This is a first tentative rewrite, I tried to adhere as much as possible to the restriction I learned in the forum, I mean return a writable event object.

I have executed the jQuery automated test suite and it passes all the tests, it also passes the "fix.html" and "offset.html" tests I found there. I have not built specific test using Custom Events but should work too with no changes for plugins developers (hope so).

For standard events I believe I have done more tests, and I have stressed it enough with the test I had already post in the forum.

Here is the DIFF patch to apply to the "event.js" source file, the patch may be used to directly patch a copy of "jquery-1.2.3.js" if somebody want to help with testing without downloading the build.

Cheers,

Diego Perini

Attachments (2)

event-fix.patch (8.1 KB) - added by diego 12 years ago.
Patch for the "event.js" source file
jquery-1.2.3-event-fix.patch (8.1 KB) - added by diego 12 years ago.
Patch for the "jquery-1.2.3.js" source file

Download all attachments as: .zip

Change History (5)

comment:1 Changed 12 years ago by brandon

Component: coreevent

comment:2 Changed 12 years ago by diego

Added new patch for the event.fix() method with following changes:

  • added an event.create() method that just fill properties of fake event object
  • better implemented the lazy function definition to get more speed in all browsers

The event.handle() method has been touched too as follows:

  • overwrite the event.type only if it is different, for Custom Events, may be implemented in Standard Events too
  • avoid duplicate calls to jQuery.data() method and reorganized the variables at the top of the function

More properties get now copied to the cloned event (may be tweaked). The properties of the newly created event will contain default values.
The event object will be writable in all browsers only when using Custom Events (can change that if really needed).

I have re-run the "test suite" and the other tests posted on the jQuery group in Firefox, IE and Opera with no errors.

I have re-submitted both patches needed to patch "event.js" and/or the full "jquery.js" sources (needs review).

Diego Perini

Changed 12 years ago by diego

Attachment: event-fix.patch added

Patch for the "event.js" source file

Changed 12 years ago by diego

Patch for the "jquery-1.2.3.js" source file

comment:3 Changed 12 years ago by brandon

Resolution: fixed
Status: newclosed

This should be addressed in Rev. [5344].

Note: See TracTickets for help on using tickets.