[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Lambda-lifting
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] Lambda-lifting |
Date: |
Wed, 2 Apr 2008 10:56:50 +0200 |
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