CLIM mail archive

[Prev][Next][Index][Thread]

consing of graphics operations



   Date: Mon, 9 May 1994 19:43:13 -0400
   From: "Scott D. Anderson" <anderson@titanic.cs.umass.edu>

   My question is about consing during graphics operations.  I know that certain
   CLIM operations, such as with-output-as-presentation will cons, but what about
   drawing lines and circles?  I have an application which is doing some animation
   of an ongoing simulation, and I want to have the objects move from place to
   place by drawing and undrawing them with +flipping-ink+.

   I'm using CLIM 2.0 in Lucid on a SPARC.  The code I've given below yields the
   following consing measurements:

   about 365 words per call to draw-circle*.
   about 158 words per call to draw-line*.
   about 596 words per call to draw-arrow*.

   This seems awfully high to me. Is it reasonable?  I can't think of why these
   operations would need to cons.  Is there a way to reduce the amount of consing
   they do?

Most of this consing is associated with output-recording.  In
addition, you are leaving the circles and arrows on the back of the
eight-by-ten color glossy..., er I mean on the pane.

You need to learn about:

(a) Turning output-recording off.  This won't be the right thing for
you in all cases, but if you know that a particular piece of output
won't be on the screen for very long, you may wish to draw it with
output-recording off.  Look up WITH-OUTPUT-RECORDING-OPTIONS.

(b) Erasing output records.  Even if you cons them in the first place,
if you erase them shortly afterward, any generational GC will do a
better job of cleaning them up.  Look up ERASE-OUTPUT-RECORD.

(c) If some parts of your animation involve simply moving a graphic
shape from one place to another, you may be able to re-use the output
record in the new location.  This is a bit of a black art, CLIM's
internal representation of coordinates being a bit hairy, but you can
get specific help on this list.

(d) Incremental redisplay.  A general facility, incremental redisplay
is often expensive overkill for simple tasks.  But you should know
about it.  Look up UPDATING-OUTPUT.

(e) Designing your own output-records for the specific task.  Also a
bit of a black art, but the best way to get ultimate performance.
Again, ask specific questions here.


References:

Main Index | Thread Index