Slow canvas performance
- From: Rob Clack <rnc sanger ac uk>
- To: gtk-app-devel-list gnome org
- Subject: Slow canvas performance
- Date: Thu, 29 Apr 2004 16:02:24 +0100
I'm writing an app which has to draw 10's of thousands of squares - it's
human genome data, so I'm not exaggerating. I'm using gtk2 and gnome
canvas running on a Compaq deskpro with 512Mb memory and Red Hat 9, but
finding performance is really poor.
Drawing a thousand or two squares is fine, but as the numbers rise, the
time taken increases to levels my users are going to find unacceptable.
I thought that if what I was drawing was outside the viewable area (ie
the canvas is bigger than the scrolled window) then it wouldn't even try
to draw the squares, but that doesn't seem to be the case. eg if the
window can show, say, 1000 squares and I run 3 tests, drawing 1000, 2000
and 3000 squares respectively, I'd expect them to take the same time to
run, since the extra squares should simply be cropped before the display
was rendered on the screen. This is not the case. The time taken
increases linearly. I thought that was the whole point of double-buffering.
Have I misunderstood how this is supposed to work or is there some
setting I've got wrong that disables that aspect? Or is there a better
way for me to set about this?
To create the item I just use
for (i = 0, x = 0.0; i < 100; i++, x += x_incr)
{
for (j = 0, y = 0.0; j < number; j++, y += y_incr)
{
gnome_canvas_item_new(group,
type,
"x1" , x ,
"y1" , y ,
"x2" , x + 5,0,
"y2" , y + 5.0,
"outline_color", "red" ,
"fill_color" , "white" ,
"width_units" , 1.0,
NULL);
}
}
x and y are doubles, so no casting is necessary.
Hope you can help.
Rob
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Eat well, stay fit, die anyway.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rob Clack Acedb Development, Informatics Group
email: rnc sanger ac uk Wellcome Trust Sanger Institute
Tel: +44 1223 494883 Wellcome Trust Genome Campus
Fax: +44 1223 494919 Hinxton Cambridge CB10 1SA
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]