[gambit-list] Scheme/C help request for code needed for Math paper

Guillaume Germain germaing at iro.umontreal.ca
Tue Jan 25 14:16:59 EST 2005


On Tue, 25 Jan 2005, Bill Richter wrote:

> I have almost 800 lines of Gambit code, at the top of my web page
> http://www.math.northwestern.edu/~richter/Richter-Curtis-algorithm.tar.gz
> and I hope someone can help me make the code run faster.

I took this as an opportunity to test my profiler.  You can see the 
resulting output at:
http://www.iro.umontreal.ca/~germaing/tmp/richter/

It seems to show that the 'hotspots' are concentrated in adem.scm, plus at 
a few other places around your code.  This might help you see where 
improvements are needed.


Also, you can speed up your code quite a bit simply by adding some 
declarations in your code.  You can read about it in the documentation:
http://www.iro.umontreal.ca/~gambit/doc/gambit-c_6.html#IDX153

Something like this [say, at the top of 'Curtis-algorithm.scm']:

(declare
  (standard-bindings)
  (fixnum)
  (not safe)
  (inline)
  (inlining-limit 1000)
  (block))

will give you some boost (I assume your numerals are all fixnums, but that 
might be wrong).  Of course there are tradeoffs to doing this, so make 
sure you understand what those declarations means.


Finally, if you want to simplify your build process, you could use 
'include' instead of 'load' in your files (except for that data file), and 
simply compile the code with:

% gsc -dynamic Curtis-algorithm.scm

then you try it with:

% gsi Curtis-algorithm


Hope this helps,

Guillaume


More information about the Gambit-list mailing list