[plt-scheme] A Comment on MzScheme Performance vis-a-vis Web Applications
On Sun, 11 Jun 2006, Eli Barzilay might have said:
> On Jun 10, Brent Fulgham wrote:
> >
> > MzScheme's performance on the newer tests is still pretty bad, but I
> > suspect a little review by Eli and Matthew will substantially help
> > in these areas.
>
> This is something that is often neglected... Take this simple code:
>
> (define (fib n)
> (if (<= n 1)
> n
> (+ (fib (- n 1)) (fib (- n 2)))))
>
> It looks innocent -- but every free variable reference is costly,
> since it can change at any second through a `set!' or re`define'. In
> this case, this means that every reference to `<=', `+', `-' and `fib'
> must be done indirectly, in case the binding changes. If you put that
> same code in a module, the environment can rely on the fact that `+'
> is always MzScheme's addition etc, and that `fib' is always a
> recursive call. You can imagine how much that can help -- and that's
> more true now than ever, since inline does happen, and bytecode is
> turned to machine code.
Would you please explain more? What free variables? 'n' is defined as
a variable to the function. It is not a wandering variable like in
BASIC.
Mike