Lew Hitchner (hitchner++at++netcom.com)
Thu, 3 Nov 1994 15:22:54 -0800
I think Jim made a great point by demonstrating the example of how
doing a little paper and pencil work (plus thinking) can make a
significant difference in performance and possibly readability of code
(if commented well). It's very tempting to assume that great general
purpose library function tools are the best way to code something.
Jim's example shows that's not always so.
I saw an example once where a programmer needed to generate his own
transformation matrix and decided the easy (lazy?) way was just to call
GL's pushmatrix(), trans(), rot(), .. whatever, getmatrix(), popmatrix().
I guessed that was probably very inefficient esp. since he had it
inside his main frame update loop (actually in a several places). Of
course, it was easier than doing the math or writing his own code for
an optimal implementation of the transformation he needed. I decided
to write my own functions to generate the matrix in software and then
run some timing comparisons, which I did on 3 different SGI platforms
(which I've forgotten now, except I know there were significant bus
differences between them and one had RE graphics another had VGX
graphics). On all machines the software version was always at least as
fast as using GL even when I stubbed out the getmatrix() (which is by
far the most time consuming of those GL calls). On one machine the GL
solution was horrible and took I think 50 times as long as the software
solution!!! That's because the getmatrix() on that machine's bus was a
real killer (on the order of 15 or 20 msec if I remember correctly --
that's mille-secs not micro-secs folks!).
Lew Hitchner
Virtual Reality and Visual Simulation Consultant
Mountain View, CA
Voice: 415-964-9425
FAX: 800-825-7689 (USA)
FAX: 510-472-6951 (international)
email: hitchner++at++netcom.com
URL: ftp://ftp.netcom.com/pub/hitchner/hitchner.html
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:38 PDT