chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Fix performance bottleneck in compiling la


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Fix performance bottleneck in compiling large files, add profiling option
Date: Sun, 22 Jan 2012 18:06:16 +0100
User-agent: Mutt/1.4.2.3i

On Sat, Jan 21, 2012 at 08:38:39PM +0100, Peter Bex wrote:
> Instead of using sprintf and allocating a new string and copying over
> every time, I've changed real-name to use build up a list and use
> string-intersperse to join them together at the end (see patch 0002 or
> changeset 27dbaf0440617fa92a33c592aba9d52b72a95117 in my branch).
> This causes compilation time to grow a lot less hard (see the red line
> in comparison.png) and compilation time to be more than halved when
> compiling the 1000-form file, but real-name is still dominating the
> procedure-calls which makes sense since there are places where the
> comment is several standard 80x25 screenfulls.  Perhaps these comments
> should be cut off at a certain length?

The attached patch adds this cutoff point, and provides for a compiler
switch to tweak this limit (and disable it by passing in 0)
This seems to produce mostly linear output and scales all the way
up to 10.000 trivial toplevel forms without breaking a sweat.  See
the nesting-settings.png for a comparison of what happens when using
a limit of 10, 100 and 0.

At 3000 forms, the compilation time is 5 seconds on my laptop versus
45 seconds without the limit.

I think this option is generally useful since if the compiler reports
a procedure nesting depth of more than about 10, this rapidly becomes
useless to a user (it also reports procedure nesting when the
scrutinizer finds a possible type error).

If someone can come up with a better option name than
"report-max-nesting", please change it.

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-Limit-depth-for-procedure-nesting-reports-to-ensure-.patch
Description: Text document

Attachment: nesting-settings.png
Description: PNG image


reply via email to

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