Side navigation
#4398 closed bug (wontfix)
Opened March 21, 2009 11:39PM UTC
Closed April 22, 2009 03:48AM UTC
Last modified September 07, 2010 01:37PM UTC
mousemove() event handling is slow
Reported by: | olau | Owned by: | brandon |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | event | Version: | 1.3.2 |
Keywords: | Cc: | olau, flesler | |
Blocked by: | Blocking: |
Description
Event handling for mousemove event still causes a significant overhead. If I attach to document.onmousemove with an empty anonymous function and wiggle the mouse on my trusty old 950 MHz PIII, Firefox 3 is using about 22% CPU. With jQuery's mousemove() and the same empty function it's about 45-50%.
Here's a breakdown of the timings from the Firebug profiler with jquery-1.3.2.js:
name calls % owntime time fix() 668 71.78% 2538.725ms 2806.368ms (line 2713) handle() 668 13.84% 489.503ms 3356.589ms (line 2666) Event() 1336 5.73% 202.810ms 267.643ms (line 2800) (?)() 668 5.09% 180.029ms 3536.618ms (line 2465)
fix() still appears to be the culprit. I think a solution might be to special-case mousemove (because we get a lot of those), as far as I can tell most of the stuff jQuery is doing on each and every of those events is completely useless for mousemoves where you typically (?) just want the pageX/pageY.
Attachments (0)
Change History (3)
Changed March 22, 2009 02:06AM UTC by comment:1
cc: | → olau, flesler |
---|---|
component: | unfilled → event |
owner: | → brandon |
Changed April 22, 2009 03:48AM UTC by comment:2
resolution: | → wontfix |
---|---|
status: | new → closed |
Changed September 07, 2010 01:37PM UTC by comment:3
The overhead is known to be caused by the page reflow when getting the "scrollTop"/"scrollLeft" (see http://dev.jquery.com/ticket/6942).
The API could provide a way to set the values of scroll and client position externally.
In such case, one could cache scroll and client position values on events that cause the change of these values and transfer them to jQuery.
Currently, the "fix" method can not even be overridden externally.
We can't make an exception for mousemove, that's completely confusing and would make our API a bad one.
I think the exception should be done on your side if needed.