[plt-scheme] Are superfluous expressions optimized away?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Feb 21 08:37:03 EST 2007

Sorry -- my reply was confusing. My reply was mean to say that such
debugging macros would not incur performance penalty. Such things like
(void) in a begin (implicit or otherwise) have long been removed by
mzscheme.

Robby

On 2/21/07, Eli Barzilay <eli at barzilay.org> wrote:
> Actually it looks like they do -- I entered these expressions in
> mzscheme:
>
>   (compile '(lambda () (void) (printf "foo\n")))
>   (compile '(lambda () (printf "foo\n")))
>   (require mzscheme)
>   (compile '(lambda () (void) (printf "foo\n")))
>   (compile '(lambda () (printf "foo\n")))
>
> and the last two (after hard-wiring mzscheme primitives) look shorter
> *and* they're identical.
>
>
> On Feb 20, Robby Findler wrote:
> > They don't. But don't take my word for it. Do some timing tests.
> >
> > Robby
> >
> > On 2/20/07, Derick Eddington <derick.eddington at gmail.com> wrote:
> > > Are superfluous expressions, like say '() or (void) when not in tail- or
> > > binding- or pass-value-position or any other value-is-used position,
> > > optimized away (maybe only when compiled to byte-code)?  I'm wondering
> > > if conditional compilation macros like (debug expr ...) which expand to
> > > '() or (void) would incur zero performance penalty?  If not, the
> > > performance cost is probably very negligible?
>
> --
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                   http://www.barzilay.org/                 Maze is Life!
>


Posted on the users mailing list.