Re: When do custom tick handlers get called?

"Adrian E. Feiguin" <[email protected]> Mon, 13 Dec 2004 12:03:32 -0800
Newsgroups gmane.comp.scigraphica.gtkextra
Message-ID <[email protected]>
Hi Al. First, let's clarify that the tick_label signal is emitted by 
canvas_paint when you have used:
gtk_plot_axis_use_custom_tick_labels (canvas_refresh only updates the 
backing pixmap in the screen). Everytime the plot is redrawn, the ticks 
are updated. gtkextra has no way to know if the values have changed or 
not, so you'll have to do it yourself.
There is a way to work around your problem:
1) generate your custom tick labels and store them in an array.
2) when you call the tick-labels generator, unless the scale has 
changed, use the array values, otherwise, recalculate.
This should be easy to implement and should work without too much tweaking.
Let me know. saludos,
<ADRIAN>

Al Hooton wrote:

>	I have set up two custom tick handlers in my app, one for the left axis
>and one for the bottom.  These are for ticks in a single plot on a
>canvas.  The tick handler for the left axis has quite a bit of
>calculation to do, in floating point, so it's somewhat compute
>intensive.
>
>	Now that the memory usage is stable, I have started working on some
>optimization.  A few hours ago I ran my first gprof(1) profile, and was
>shocked to find my app spending 60%+ of it's total processor demand in
>the custom tick handler for my left axis!  Needless to say, I had not
>expected to find my first bottleneck there...   8^)=
>
>	I was under the assumption that when canvas_refresh() called down to a
>plot to refresh itself, the plot would not spend time regenerating the
>axes *unless* gtk_plot_set_ticks() had been called.  If set_ticks() has
>not been called, then the axes scale/ticks have not changed, so I
>figured the child plot would not rebuild/paint the axes every time it
>was called.  I now see that assumption was incorrect.  Since I'm calling
>canvas_refresh a few times a second (because other things are moving on
>it), I'm also regenerating my axes this often, even though they never
>change after I initially set them up.  This is what's eating all of my
>processor cycles.
>
>	Adrian, is there some way to get a plot to update all of it's children
>*except* the axes when it's asked to refresh itself?  Or, is there
>another approach that I'm missing?
>
>	Thanks!
>
>-Al
>
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now. 
>http://productguide.itmanagersjournal.com/
>_______________________________________________
>Scigraphica-gtkextra mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/scigraphica-gtkextra
>
>.
>
>  
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/