Bug 90353 - [PresentationAPI] Cache widgets for recently opened perspectives
Summary: [PresentationAPI] Cache widgets for recently opened perspectives
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.2 M1   Edit
Assignee: Stefan Xenos CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
: 27179 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-05 15:18 EDT by Stefan Xenos CLA
Modified: 2005-10-13 11:06 EDT (History)
5 users (show)

See Also:


Attachments
Implements this optimization (1.82 KB, patch)
2005-05-12 20:49 EDT, Stefan Xenos CLA
no flags Details | Diff
Fixes internal references that have changed (ui.tests) (3.38 KB, patch)
2005-05-12 20:51 EDT, Stefan Xenos CLA
no flags Details | Diff
workbench patch (69.61 KB, patch)
2005-05-12 20:52 EDT, Stefan Xenos CLA
no flags Details | Diff
Performance logs (2.81 KB, application/octet-stream)
2005-05-12 22:08 EDT, Stefan Xenos CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Xenos CLA 2005-04-05 15:18:22 EDT
The last time I profiled switching perspectives, a large portion of the time was
spent re-creating the presentation widgets.

We could improve the time to switch perspectives by about 40% if we cached the
widgets for the last 3 opened perspectives rather than destroying and recreating
them every time.
Comment 1 Michael Van Meekeren CLA 2005-04-05 15:33:39 EDT
Heap usage would be a concern here?  Is it the actual creation of the widgets or
layout, menus etc... being calculated that take time?
Comment 2 Michael Van Meekeren CLA 2005-04-05 15:37:48 EDT
move performance to keyword field
Comment 3 Stefan Xenos CLA 2005-04-05 16:10:22 EDT
It's the creation of widgets. The CPU time is being spent in
PartStack.createControl(), and this is the call we'd avoid by caching. (Well,
there's also optimizations we can make to building menus, etc... but I've filed
separate PRs for them.)

Of course it would also have a cost in heap space, but if we only cache a
(small) constant number of perspectives, the cost shouldn't be too bad.
Comment 4 Stefan Xenos CLA 2005-04-21 17:17:03 EDT
see bug 27179
Comment 5 Mike Wilson CLA 2005-04-22 09:03:12 EDT
As usual, we need to think about both time and space performance. How much space are we talking 
about?
Comment 6 Stefan Xenos CLA 2005-05-12 20:49:58 EDT
Created attachment 21078 [details]
Implements this optimization

Implements this optimization.

I don't want to commit this until I've tested it more, but I'm attaching it
here so that anyone who is interested can confirm the my claims about heap and
CPU usage.
Comment 7 Stefan Xenos CLA 2005-05-12 20:51:08 EDT
Created attachment 21079 [details]
Fixes internal references that have changed (ui.tests)
Comment 8 Stefan Xenos CLA 2005-05-12 20:52:38 EDT
Created attachment 21080 [details]
workbench patch

Oops... attached the wrong patch above
Comment 9 Stefan Xenos CLA 2005-05-12 22:08:18 EDT
Created attachment 21081 [details]
Performance logs

It looks as if the performance improvement is pretty impressive. Keep in mind
that these comparisons were done against the code in head, which is aleady 70%
faster than Eclipse 3.0 (according to the automated tests).

In optimize-it, the time spent in WorkbenchPage.setPerspective was reduced from
222ms to 101ms (54% improvement).

I also tested with the performance suites (console logs attached). Here's some
of the highlights. Times are shown as (old time / new time / %improvement):

perspective switching:

java/debug: (447 / 232 / 48%)
performance1 / performance2: (168 / 75 / 55%)
dragdrop / fastview: (119 / 76 / 36%)
java / empty: (226 / 171 / 42%)
resource / java: (416 / 261 / 37%)
Comment 10 Stefan Xenos CLA 2005-05-12 22:22:25 EDT
Just started testing this -- there are definitely bugs still. ;-)
Comment 11 Michael Van Meekeren CLA 2005-05-13 12:02:00 EDT
speed to switch perspectives has improved but what about memory and handle
usage?  I'd like to see this running on MacOS or GTK to see the impact of
keeping what amounts to an extra perspective page or two worth of widgets etc...
around.
Comment 12 Stefan Xenos CLA 2005-05-13 12:36:45 EDT
Re: comment 11 

I can only do so much in a day. I originally estimated that this code change
would take a week, and its now almost finished after one (very long) day. I will
get some memory numbers ASAP.
Comment 13 Stefan Xenos CLA 2005-07-11 19:21:58 EDT
Heap cost is approx 17k per perspective (the default Java perspective uses 674k,
so this is approx. a 3% increase).
Comment 14 Stefan Xenos CLA 2005-07-11 19:22:23 EDT
Fixed in head.
Comment 15 Mike Wilson CLA 2005-07-12 08:39:23 EDT
My goodness! Does anyone else think 674K for one perspective is a lot?
Comment 16 Stefan Xenos CLA 2005-07-12 14:40:33 EDT
I'm including the memory used by the views themselves, and I measured this on a
"real" workspace, so I'd expect the problems view and package explorer to be
using a fair chunk. I measured the memory increase for opening the Java
perspective for the first time when the debug perspective was active.
Comment 17 Douglas Pollock CLA 2005-08-09 14:27:06 EDT
Looking at a sampling of the performance results for I20050808-0800, it seems 
that this patch (at least in part) has contributed to some significant 
performance improvements for perspective switching. 
 
Comment 18 Stefan Xenos CLA 2005-08-11 15:39:03 EDT
More accurately, this patch is almost solely responsible for significant
performance improvements, as evidenced by my own test results (above) and tod's
tests when he experimented with rolling this back.
Comment 19 Mark A. Ziesemer CLA 2005-10-05 15:13:14 EDT
Would you please look at bug 108033?  I think this broke the persistence of the 
view tab orders between workbench sessions...
Comment 20 Stefan Xenos CLA 2005-10-13 11:06:41 EDT
*** Bug 27179 has been marked as a duplicate of this bug. ***