discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Application startup performance tuning...


From: Willem Rein Oudshoorn
Subject: Re: Application startup performance tuning...
Date: 14 Mar 2003 21:06:43 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Michael Hanni <mhanni@yahoo.com> writes:

> Hi,
> 
> We are spending a boat load of time constructing the menus and acting on the
> various messages sent to the menus during startup. By my testing NSMenu
> sizeToFit is called 71 times on loading GSTest.app alone (loading
> GWorkspace.app is even more intense, several hundred would be a good guess.)

That is a lot.

> Attached is a patch that kills 67 of those calls. Visually things look faster
> and there are no display problems that I could see. 

I just looked at your patch.  I think I would have taken a different approach.
See, the _changed flag is already there and is basically just what you need.
If you just change the -[NSMenu update] method by replacing:

if (_changed)
   [self sizeToFit]

to 

if (_changed && ([_aWindow isVisible] || [_bWindow isVisible]))
   [self sizeTofit];

and adjust the -displayTransient method by adding

 if (_changed)
   [self sizeToFit];

you achieve basically the same effect, with, as far as I can see 
the following benefits:

* You avoid an extra ivar
* It will delay all (most) the sizing when the menu is not visible, 
  instead of only during startup.

BTW to take full effect the setTitle method should be adjusted as well.


Also I think it is worthwhile fixing these issues.  Especially if
you can notice the difference.

Wim Oudshoorn.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]