[Shootout-list] Rule 30

John Skaller skaller@users.sourceforge.net
Sat, 21 May 2005 14:09:36 +1000


On Thu, 2005-05-19 at 23:12 -0700, Isaac Gouy wrote:
> --- John Skaller <skaller@users.sourceforge.net> wrote:
> > On Thu, 2005-05-19 at 16:30 -0700, Isaac Gouy wrote:
> > > --- Jon Harrop <jon@ffconsultancy.com> wrote:
> > > -snip-
> > > > Some implementations may precompute it without the reader's
> > > > knowledge. More worryingly, some language implementations may
> > > > precompute it without the author's knowledge.
> > > 
> > > Which do?
> > 
> > ALL compilers do constant folding which is a trivial
> > example of this...
> -snip-
> 
> The question had a specific context - pidigits.

Ok, I was generalising as usual :)

> Jon's answer was "We don't know which do. That's the point."
> 
> Somewhere between none (an imaginary problem) and all of them.
> Perhaps the point is to find someone who knows more.

Yes, but I think the generalisation suggests the problem
can be avoided by avoiding tests where this kind of optimisation
is possible.

I have to think, though, that entirely avoiding it is self-defeating:
most optimisation is 'redundancy reduction' and if we eliminate it
from the tests, then there is no space for optimisers to compete.

-- 
John Skaller, skaller at users.sf.net
PO Box 401 Glebe, NSW 2037, Australia Ph:61-2-96600850 
Download Felix here: http://felix.sf.net