<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.30.3">
</HEAD>
<BODY>
<Explanation by Marc about padding in call frames deleted.><BR>
<BR>
Ah, so this is the cost that all calls incur in Gambit so that one can implement call/cc?<BR>
<BR>
I thought of this when perusing<BR>
<BR>
<A HREF="http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=auto&tl=en&u=http%3A%2F%2Fcall-with-hopeless-continuation.blogspot.com%2F2010%2F03%2Flies-damn-lies-and-benchmarks.html">http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=auto&tl=en&u=http%3A%2F%2Fcall-with-hopeless-continuation.blogspot.com%2F2010%2F03%2Flies-damn-lies-and-benchmarks.html</A><BR>
<BR>
(apologies to those who understand the original Italian).  The guy says that he wrote the C code<BR>
<BR>
<TT>include <stdio.h></TT><BR>
<BR>
<TT>int fib (int n) {</TT><BR>
<TT>  if (n == 0 || n == 1) {</TT><BR>
<TT>    return n;</TT><BR>
<TT>  } else {</TT><BR>
<TT>    return fib(n - 1) + fib(n - 2);</TT><BR>
<TT>  }</TT><BR>
<TT>}</TT><BR>
<BR>
<TT>int main() {</TT><BR>
<TT>  int n;</TT><BR>
<TT>  for (n = 0; n < 40; n++) {</TT><BR>
<TT>    printf ("fib(%d)=%d\n", n, fib(n));</TT><BR>
<TT>  }</TT><BR>
<TT>  return 0;</TT><BR>
<TT>}</TT><BR>
<BR>
and the scheme code<BR>
<BR>
<TT>declare (standard-bindings)</TT><BR>
<TT>       (extended-bindings)</TT><BR>
<TT>       (block)</TT><BR>
<TT>       (not safe))</TT><BR>
<BR>
<TT>(define (fib n)</TT><BR>
<TT>  (if (or (fx= n 0)</TT><BR>
<TT>        (fx= n 1))</TT><BR>
<TT>      n</TT><BR>
<TT>      (fx+ (fib (fx- n 1))</TT><BR>
<TT>         (fib (fx- n 2)))))</TT><BR>
<BR>
<TT>(do ((n 0 (fx+ n 1)))</TT><BR>
<TT>    ((fx= n 40))</TT><BR>
<TT>  (for-each display</TT><BR>
<TT>          (list "fib(" n ")=" (fib n) #\newline)))</TT><BR>
<BR>
and on his box Chicken ran the Scheme code (at -O5 compilation level) faster than the C code with<BR>
<BR>
<TT>gcc -O3 -W -Wall -o fib_c fib_c.c</TT><BR>
<BR>
On my box, I don't have chicken installed, but<BR>
<BR>
<TT>heine:~> time ./fib_c</TT><BR>
<TT>1.490u 0.000s 0:01.49 100.0%  0+0k 0+0io 0pf+0w</TT><BR>
<BR>
and after compilation<BR>
<BR>
heine:~> time gsi fib_scm<BR>
4.860u 0.010s 0:04.87 100.0%    0+0k 0+0io 0pf+0w<BR>
<BR>
So, it looks like Chicken really smokes Gambit on this femtobenchmark.  The question is, should it?<BR>
<BR>
(I suppose you'll come back with benchmarks using your native x86-32 back end at this point, but I need to run 64-bit Gambit ...)<BR>
<BR>
Brad
</BODY>
</HTML>