Re: simplelist speed

muppet <scott asofyet org> writes:

On Jan 3, 2005, at 9:57 PM, Dan Espen wrote:

I needed to color the foreground of individual cells and the 
background of some rows.  I used pango markup for the foreground and 
cell_data_func to  color the background.

On my 400MHz home machine, I can peg the CPU meter by moving the 
pointer over the window.  When I switch to the desk that shows 2 
instances of this program the text takes about 5 seconds to appear.

Unfortunately i can't say i'm surprised by this.  The TreeView 
architecture is flexible and powerful, but the design requires it to do 
a hell of a lot of work.

A way to approach the speed problems is to find ways to cache things.  
To avoid needing to parse pango markup or call a cell data func on 
every cell rendering, try using a hidden column (that is, a model 
column that is not shown in the view) to store the GdkColor to use for 
the foreground and background colors, and calculate them only once.  
You'll then tell the TreeViewColumn to use the hidden column as a cell 
attribute, that is, for a given cell it will fetch the color from the 
corresponding row of that column of the model.  This would also avoid 
the need for the cell data func, but would require you to keep the 
color columns up to date by hand.
What improvement to you see from using text rather than markup columns?

Just  reporting back, I've    removed  the pango markup, the    markup
columns, the    cell data function,   and I'm  doing all   coloring as
described above.

I  think  its about the  same  as before.  I timed  it  this time, its
actually about 3   seconds for data to   appear,  way too slow to   be
usable.  It's about the same  without the color.   It looks like  it's
just the number of cells.

I guess this isn't a GtkPerl problem.

I'm not sure what I'll be trying next...

Dan Espen                           E-mail: dane mk telcordia com

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