chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Another exponential case: analyze-expressi


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Another exponential case: analyze-expression on LET expressions
Date: Sun, 29 Jan 2012 16:36:34 +0100
User-agent: Mutt/1.4.2.3i

On Sat, Jan 28, 2012 at 01:21:12PM +0100, Felix wrote:
> I think this change is not correct - "lambda" and "let" are not
> equivalent at this stage of the compiler: "let" introduces local
> variables and "lambda" creates a procedure.

Here's another patch which basically does the same thing, but without
changing LET's semantics.  Instead of appending localenv to env at each
node below the let it keeps around another variable which represents
the "full environment", which carries everything in "env" and "localenv".

There's still potentially exponential behavior in the memq calls
which check whether something's in the local environment, but avoiding
the append calls not only saves time appending but of course also saves
on time spent in the GC.  My measurements produced a near-exact copy of
the comparison picture in my original mail.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: 0001-In-the-analysis-phase-keep-around-a-copy-of-localenv.patch
Description: Text document


reply via email to

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