[Shootout-list] Rule 30
Jon Harrop
jon@ffconsultancy.com
Sat, 21 May 2005 10:18:42 +0100
On Saturday 21 May 2005 05:09, John Skaller wrote:
> 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:
> > > > > 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 :)
We should discuss this generally as the fix is generally applicable.
> > 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.
Exactly.
> 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.
No, it is not self-defeating. We can design benchmarks where no part can be
completely optimised away. That is quite different from saying that no
optimisations can be done. Most optimisations will be specialisations or
rearrangements, which is exactly what we should be testing as these are the
optimisations which speed up real programs.
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists