chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Lambda-lifting


From: Houman Zolf
Subject: Re: [Chicken-users] Lambda-lifting
Date: Thu, 3 Apr 2008 11:07:38 -0400

I did this kind of test once.

I had a compiler generating functions with lots of nested lambdas, and
the generated code had to be reasonably fast. Intuitively
lambda-lifting should have had a major impact.
But I was surprised to see that using the -lambda-lift option did not
yield any significant performance improvement.

I would be nice to understand the value of this optimisation, or
alternatively the cost of what we are trying to improve.
In given the example, what do we save exactly? Is it the creation of
the closure when we evalulate :
  (let ((some-func (lambda (x) (print "x: " x ", y: " y))))
Intuitively, I thought the creation of all these closures  in the
evaluation chain would be expensive.

Any insights about that?

Houman


On Wed, Apr 2, 2008 at 4:56 AM, felix winkelmann <address@hidden> wrote:
> On Tue, Apr 1, 2008 at 6:44 AM, John Cowan <address@hidden> wrote:
>  > What are the upsides and downsides of the -lambda-lift switch in csc?
>  >
>
>  The compiler does a simple form of lambda-lifting optmization, which means
>  lifting internal, known procedures to toplevel and passing any free variables
>  as extra arguments. So
>
>  ...
>  (let ((y 99))
>   ...
>   (let ((some-func (lambda (x) (print "x: " x ", y: " y))))
>    ...
>       (some-func whatever)
>
>  can be rewritten to
>
>  (define <hidden-some-func> (lambda (x y) (print ...)))
>
>  ...
>
>  (let ((y 99))
>   ...
>   ...
>   (<hidden-some-func> whatever y)
>
>  This can improve performance in certain situations. In my experience
>  it doesn't make much of a difference, but chicken's lambda-lifter does
>  only optimize the simplest cases. You have to try out whether it gives
>  any improvements.
>
>
>  cheers,
>  felix
>
>
>
>
>  _______________________________________________
>  Chicken-users mailing list
>  address@hidden
>  http://lists.nongnu.org/mailman/listinfo/chicken-users
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]