On Sat, 26 May 2001, Ben Wing uttered the following:
Martin Buchholz wrote:
> Offhand, it bothers me that most struct gcpro protect just one
> variable, so much of the time the initialization and reading of the
> nvars member is wasted. But I don't know whether this can be easily
> optimized away. Could one have a gcprolist with only `simple'
> variables, and a multiple_gcprolist that can protect arrays of
> variables?
trying to optimize gcpro is wasted effort. [in fact, all attempts to optimize
individual machine cycles are wasted efforts -- all you're doing is decreasing
the constant factors slightly. you should read the sections on O[n] and
optimization in an introductory CS textbook.]
Not strictly true; in some places GCPRO can contribute more than
constant time; e.g. inside recursive functions, or functions that are
indirectly called recursively. (There aren't many such yet that I can
see; in one place the comment says this is because it was too hard to
keep the GCPROs straight... :(
But, yes, fixing the algorithms is always a better move. I will, of
course, restrain myself from replacing GCPRO with something that is
insanely slow (that, say, does dynamic allocation or something)...
(One viewpoint is that GCPROs are extra complexity of a totally
mechanical nature and so they should be dealt with by computers. That's
what they're good at.)
--
`Technology is meaningless. What matters is how people _think_
of it.' --- Linus Torvalds