[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] compile time wanderings
From: |
Felix Winkelmann |
Subject: |
Re: [Chicken-users] compile time wanderings |
Date: |
Wed, 16 Jun 2004 07:43:17 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 |
Cs. Henk wrote:
Hi!
I tested the compilation of the following kind of code:
(define (f0) 0)
(define (f1) (+ 1 (f0)) )
(define (f2) (+ 1 (f1)) )
(define (f3) (+ 1 (f2)) )
(define (f4) (+ 1 (f3)) )
(define (f5) (+ 1 (f4)) )
...
(display (f1000)) (newline)
with different values in place of 1000.
First I tried to do it with 10000, I got bored after some hours, so I
stopped the compilation.
Then trying it with 1000, 2000, and 3000, I had the feeling that compile
time grows exponentially (for 1000, the code compiled in cca. 40 sec
time, for 2000, it needed 2 minutes, for 3000, it took cca. 5 and a half
minutes).
Yes, especially the closure-conversion phase is rather expensive and
takes a lot of time. You can run chicken with the -debug b option
to see how long each compilation phase takes.
And then I re-tried the above with 10000 as follows: broke up the code
to 1000-line chunks, compiled them separately, linked the object files.
This procedure, of course, took ten times longer than the compilation
time with 1000.
Now I wonder what property of chichken causes that compilation time
grows exponentially related to code size, and that is there a way to
make it behave similary during the compilation of one big file
to the case when several small files are compiled and linked... ?
Jonah Beckford is working on a new feature that allows splitting a compiled
Scheme file into several .c files that can be compiled separately. But this
is mainly intended to reduce C compile times.
There lurk a few suboptimal algorithms in the compiler, admittedly. I will
try to address this, but don't hold your breath... ;-)
cheers,
felix