[gambit-list] compiling fib

Marc Feeley feeley at iro.umontreal.ca
Wed Jan 26 10:39:26 EST 2011


On 2011-01-24, at 4:00 PM, Marc Feeley wrote:

> 
> On 2011-01-21, at 2:59 PM, Bradley Lucier wrote:
> 
>> What kind of speedups do you see on your new version of fib with the native back end?
> 
> On x86-32 I tried fib_scm and fib_c.  I removed the printf/display because the x86-32 back-end doesn't support Gambit's I/O library yet.  I also played with various options and the inlining level and used (not interrupts-enabled) by default.  The run time for the plain "no special tweaks" compilation of fib_scm on Gambit-C is also given.  In parentheses is the time relative to the fastest time.  I'm using this morning's Gambit-C patch which improves the speed of jumps to the return address.
> 
> gcc -m32 -O1 -fomit-frame-pointer                3.11s (3.3x)
> gcc -m32 -O2 -fomit-frame-pointer                2.72s (2.9x)
> gcc -m32 -O3 -fomit-frame-pointer                0.93s (1.0x)
> Gambit-x86-32 (inlining-limit 1000)              1.03s (1.1x)
> Gambit-C (inlining-limit 300) -cc-options "-O2"  1.31s (1.4x)
> Gambit-C (inlining-limit 300)                    1.65s (1.8x)
> Gambit-x86-32 (not inline)                       1.75s (1.9x)
> Gambit-x86-32 (not inline) (enable-interrupts)   2.11s (2.3x)
> Larceny x86                                      2.64s (2.8x)

I added a simple optimization to the x86 back-end (using the "lea" instruction to compute r1=r2+n instead of a "mov" and "add").  This has improved the execution time:

gcc -m32 -O1 -fomit-frame-pointer                       3.11s (3.42x)
gcc -m32 -O2 -fomit-frame-pointer                       2.72s (2.99x)
gcc -m32 -O3 -fomit-frame-pointer                       0.93s (1.02x)
Gambit-x86-32 (inlining-limit 1000)                     0.91s (1.00x)
Gambit-x86-32 (inlining-limit 300) (enable-interrupts)  1.06s (1.16x)
Gambit-x86-32 (not inline)                              1.81s (1.99x)
Gambit-x86-32 (not inline) (enable-interrupts)          2.12s (2.33x)
Larceny x86                                             2.64s (2.90x)

Now Gambit with the x86-32 back-end is slightly faster than gcc -O3.

Marc




More information about the Gambit-list mailing list