Export to GitHub

neap - issue #9

misc performance enhancement


Posted on Oct 31, 2010 by Happy Monkey

Attached is a proposal for a performance enhancement that implies modifications on the code structure.

On the current version the grid and the icon are updated on each event, i.e. dozens of times when a window is moved or resized.

This version includes the following enhancements : - allocate pixmap, gc, colormap and 3 colors only once - updates the grid only when desktop layout or number has changed - redraws the icon only when the current desktop has changed or the grid has been updated

However, it assumes that the config does not change after the Neap object has been initialized, so I moved all the configuration to a NeapConfig object that is created before the Neap object.

I'm not used to gtk - played once with it a few years back, so I'm not aware whether GTK objects (pixmap, gc, etc) should be allocated on each redraw ? (I did not see any glitch or weird stuff during my few tests.)

Could you have a look and tell me if you're OK with those modifications ?

Thanks

Comment #1

Posted on Nov 1, 2010 by Happy Horse

What do you mean by "attached"?

Allocating GTK stuff only once and updating the grid / redrawing the icon only when necessary has been in my mind for quite some time now, it's good to hear that it's finally been fixed.

I don't yet see why we need a NeapConfig object, but it doesn't seem to be a bad idea on its own.

I'm not used to GTK either; in fact, this is my first GTK application (and my second Python application, I'm actually a C programmer writing libraries). But as far as I know, GTK objects must not be re-allocated on each redraw.

Since we now all know about the changes of the code structure, I think it suffices if you just upload your code to the SVN repo. I will check it there.

Comment #2

Posted on Nov 1, 2010 by Happy Monkey

"attached" as in "attached file", which means I forgot to attach the file :)

I uploaded the code to the SVN repo (r63).

Actually we don't really need a NeapConfig object but with those modifications, not using a separate object was as complex and less "correct" (in my opinion) as using one. I just needed to make Neap have all config set on init, and this was the best way I could think of :)

Comment #3

Posted on Nov 2, 2010 by Happy Horse

Finally, I found some time to see through your code. Looks fine to me :)

I tend to forget attachments as well...

Comment #4

Posted on Feb 4, 2011 by Happy Horse

I forgot to release a new version based on your improvements. Sorry + fixed.

Status: Verified

Labels:
Type-Enhancement Priority-Medium