On Mon, Oct 11, 2010 at 12:17:06PM +0200, Carlos R. Mafra wrote:
> 
> It feels better to have a light code path during app-openning time and
> do only the strictly necessary stuff. So I prefer to avoid having to rewrite
> the icon every single time.
> 
> I think we can go one step further and my patch is one possible attempt 
> at that. I'll probably commit it.

I did a little testing, the slowest part is re-saving WMWindowAttributes
when it hasn't been changed, which is easy to check for. The attached
patch fixes that nicely.

I doubt anyone would really notice the remaining hundredths of a second
you save unless they were looking for it. And if they really do, it can
be cut down to microseconds by specifying a non-cached icon instead of
using the cached version (in which case it doesn't update the cache at
all).
diff --git a/src/application.c b/src/application.c
index fad9186..f3993ff 100644
--- a/src/application.c
+++ b/src/application.c
@@ -165,6 +165,8 @@ void wApplicationSaveIconPathFor(char *iconPath, char 
*wm_instance, char *wm_cla
                val = WMCreatePLString(iconPath);
                WMPutInPLDictionary(adict, iconk, val);
                WMReleasePropList(val);
+       } else {
+               val = NULL;
        }
        WMReleasePropList(key);
        WMReleasePropList(iconk);

Reply via email to