Bug 51430 - ui getting more and more slower (profiler shows too much time in event loop)
Summary: ui getting more and more slower (profiler shows too much time in event loop)
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2004-02-09 21:12 EST by quartz quartz CLA
Modified: 2004-02-13 12:46 EST (History)
0 users

See Also:


Attachments
profiler snapshot (297.43 KB, image/jpeg)
2004-02-09 21:13 EST, quartz quartz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description quartz quartz CLA 2004-02-09 21:12:48 EST
The UI becomme more and more cluttered with tooltips, animations, styled text
and so on.

A simple mouse hovering consumed lot of cpu time, without even showing tooltips,
showed huge amount of events and processing.

The swt event dispatch loop should be optimized to execute faster. If not,
coalescable mouse events, like mouse moves, should be coalesced to eliminate
wasted processing. (It simply requires a insert-ordered map in which we put
events, but by a "type" key that allows to clobber the event with the latest
value). This may save up to 95% of the eventloop processing on busy UI.

profiler snapshot in attachment.
The testcase was a simple mouse hover on a java editor.
Comment 1 quartz quartz CLA 2004-02-09 21:13:56 EST
Created attachment 7742 [details]
profiler snapshot
Comment 2 Grant Gayed CLA 2004-02-12 11:12:17 EST
SN will be looking at performance issues.
Comment 3 Steve Northover CLA 2004-02-12 13:21:28 EST
Please submit your patches that show the speed up.  Thanks.
Comment 4 quartz quartz CLA 2004-02-12 23:29:48 EST
Hum. If you have a month to show me how to build and hack the eclipse core,
I may be able to give you a patch ;)

For the mean time, I'm giving you a technique that was successfull in my past
experiences and designs.

I can give more details, if you want but it will remain theory until somebody
else than me makes a prototype for eclipse awt event processing.

The safest optimization is to coalesce only successive unprocessed events of
same types. I would only coalesce mouse drags and mouve moves. I presume you
understand that it requires intercepting all mouse events, do coalescing if any
and finally forwarding them. That could be done only per components, the editors
being a very good example.

The actual effect is to strip mouve move/drag event from the event queue, so
that it doesn't trig processing. If the consumer processing is always very
responsive (too responsive*) the coalescing would never occur. If the consumer
chokes, it will benefit from useless events being removed on the procuder enqueue.

I wrote "too responsive" because if the ui gets the CPU, it doesn't mean that
the CPU has nothing else to do. May the consumer thread is just of higher
priority and just moving the mouse over an editor sucks up the CPU power.

I would slowdown the consumer thread by emulate a very short latency (few dozen
ms) the user wouldn't feel, but choked enough so that we can provoque coalescing
and basically code a somewhat constant event processing rate.

(Sometimes I feel that tricks like this have already been tried, but I feel the
need to make sure you considered it.)

Thanks.
Comment 5 Steve Northover CLA 2004-02-13 12:46:44 EST
The operating systems themselves collapse mouse move events and there is no 
chance that we would ever try to play with the operating system event queue in 
this manner.