gnustep-dev
[Top][All Lists]
Advanced

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

Re: Slow application startup when using a theme


From: Philippe Roussel
Subject: Re: Slow application startup when using a theme
Date: Tue, 10 Jan 2012 11:26:20 +0100

Le mardi 10 janvier 2012 à 10:56 +0100, Fred Kiefer a écrit :
> On 10.01.2012 05:54, Eric Wasylishen wrote:
> > I didn't like the current approach either…  I just committed a
> > rewrite of how theme images are handled which gets rid of theme
> > proxies entirely, and eliminates the code in -[GSTheme activate] and
> > -[GSTheme deactivate] which were setting/restoring images.
> >
> > Now, when a name is set on an NSImage instance, it also subscribes to
> > the theme change notification. When an NSImage receives this
> > notification, it does the name-to-path lookup again that +[NSImage
> > imageNamed:] did, and reloads itself (discarding all reps) if the
> > path has changed.
> >
> > It's a fairly major change but I tested Gorm, GSTest, SimpleAgenda,
> > and tried switching between the GNUstep default theme, Neos, and
> > Etoile's Nesedah theme while the apps were running, and all images
> > seemed to update properly.
> 
> I am completely impressed by what you did here. On the other hand, I 
> cannot look at code without trying to find flaws in it. Sorry, I am just 
> made that way.
> 
> So this is what I found:
> 
> - After your code is verified by tests we should get rid of the complete 
> class GSThemeProxy.

And there is a duplicate #import <Foundation/NSNotification.h>

> - The code in [NSImage imageNamed:] could be simpified, not that the 
> proxy is gone. We don't need to get the same image we just created from 
> the dictionary.
> 
> - I don't quite understand what happens when we switch back from having 
> a theme to not using one. Will the standard GNUstep images get reused? 
> The question here is whether we send the notification 
> GSThemeDidActivateNotification when there is no theme at all.

I tested it (by adding NSLog) and it works : when going back from Neos
to native GNUstep theme, -themeDidActivate is called and the paths are
recomputed and the bitmaps loaded if needed.

Nitpicking : instead of registering for GSThemeDidActivateNotification
for every image (and getting x notifications), it would probably be more
efficient to register only once (but how ?) and check every image cached
in nameDict.

Anyway, this is a nice improvement of the code and of the user
experience, I like it when my computer seems faster :o)

Thanks,
Philippe




reply via email to

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