Re: Optimization question

Since you are painting numbers, the fastest would be to do a prerendering
of all the numbers and store these in GdkPixbuf's in memory. The conversion
of an altitude reading to a number to display would then just need to
use a series of gdk_pixbuf_copy_area() to draw each of the numbers.
Using any kind of external file representation like png, is just a waste
of time.

You can do the same thing with GdkImlib images, btw, that are currently
required for the canvas. You don't need to destroy your objects btw. A
simple canvas_image->set("image"->$image) repaints the image, if I'm
not mistaken.


On Mon, Feb 04, 2002 at 01:59:02PM -0500, Daniel Carrera wrote:
I'm working on a space station simulation and I need some optimization
advice.  The bottleneck is definitely the altitude reading.  It consists
of a 6-digit number that is rendered to the screen using images (PNGs).
To create the feeling of real time, this number is updated every 10

I definitely want to use images for the simulation.  It is intended for
preschoolers so it should look nice.

I have a few questions:
1)  Is there any particular format that is rendered faster than the
others?  I am using PNGs right now.  Should I use something else?

2)  How does Gtk manage memory?  If one object is hidden by another, is
the first still in memory?  I ask because currently the altitude reading
belongs to a canvas group.  Every time that the altitude is updated (every
10 milliseconds) I destroy the group and build an entirely new one.

    This must consume a lot of CPU power.  I thought that I might just
draw the new number on top each time.  However, if the old ones will
remain in memory, this approach would suck the entire system's memory very

Any advice on this matter would be much appreciated.

Thanks in advance,

gtk-perl-list mailing list
gtk-perl-list gnome org

Dov Grobgeld                        | Email: dov orbotech com      /+  \  PCB
Algorithms Group Leader, Orbotech   | Phone: +972-8-9423882        \  +/  AOI
POB 215, Yavne 81102, Israel        | Fax:   +972-8-9423775       __| |
               Disclaimer: All views above are mine alone.        ____|

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