[gambit-list] Help With Memory
Marc Feeley
feeley at iro.umontreal.ca
Fri Sep 26 09:23:20 EDT 2008
On 25-Sep-08, at 10:46 PM, Bradley Lucier wrote:
> On Sep 25, 2008, at 10:21 PM, Alex Shinn wrote:
>
>>
>> Marc Feeley <feeley at iro.umontreal.ca> writes:
>>
>>> Gambit does not use Cheney on the MTA, mainly because it interferes
>>> with the implementation of unrestricted calls from Scheme to C and
>>> from C to Scheme. Gambit's implementation of continuations is done
>>> with a lazy copy of the captured continuation. The performance is
>>> quite good... on the two call/cc intensive Gambit benchmarks (ctak
>>> and
>>> fibc) Gambit outperforms Chicken.
>>
>> Really? This page
>>
>> http://www.ccs.neu.edu/home/will/Twobit/benchmarksFakeR6Linux.html
>>
>> shows Chicken outperforming Gambit on ctak (it doesn't have
>> fibc).
>
> It has fibc (gambit code runs faster than chicken code).
The latest set of benchmark results I have (Gambit-C 4.2.8 with latest
patches, Chicken 3.3.0 SVN rev. 11106, gcc 4.0.1, Mac OS X 10.5.5, Mac
Book Pro, 2 GB RAM, 2.0 GHz Dual Core Intel CPU) give:
"r5rs" mode:
ctak: Chicken is 1.71 times slower than Gambit
fibc: Chicken is 2.60 times slower than Gambit
"r6rs" mode:
ctak: Chicken is 1.03 times slower than Gambit
fibc: Chicken is 1.34 times slower than Gambit
The difference between the two modes is that in "r6rs" mode the
(standard-bindings) declaration is used, i.e. the predefined variables
are assumed to be immutable (so "+" is bound to the addition function,
etc). Note that on SUN, Clinger's benchmarks (with different versions
of the compilers) give a factor of 2 advantage to Gambit on these
benchmarks so the processor architecture probably has an influence as
well.
The slight variation with Clinger's results for "r6rs" mode is
probably due to improvements/degradation in the Scheme and C
compilers, and the different set of options given to the compilers to
try to make them assume a similar setting (including the amount of RAM
available for the heap).
The point I am trying to make is that in a Scheme to C compiler
continuations can be implemented in other ways than Cheney on the MTA
to get a system with good performance for call/cc. Whether one system
is a few percent faster than the other on these benchmarks is quite
possibly due to other factors unrelated to the implementation of
continuations.
Another point I want to make is that Cheney on the MTA give you "free"
call/cc only after paying a premium on other things, namely stack-like
behaving function calls and tail-calls. Because typical code, and
even realistic call/cc intensive code such as a thread system, do much
more of these other things than calling call/cc, the overall
performance of the system is suboptimal in general. With the latest
set of benchmark results on 51 benchmark programs, in "r6rs" mode
Chicken is 2.7 times slower than Gambit on average (geometric mean).
That's the cost of "free" call/cc.
Marc
More information about the Gambit-list
mailing list