[plt-scheme] Ants from ICFP

From: Felix Klock's plt proxy (pltscheme at pnkfx.org)
Date: Thu Jun 10 16:46:55 EDT 2004

On Jun 10, 2004, at 3:20 PM, Arjun Guha wrote:
> I'll post the rest over the weekend.  The most important optimization 
> is that I preprocess instructions running the simulation (i.e. I 
> create 10,000 * 2 procedures) so that I don't have to  lookup states.

I actually tried this technique (I was quite pleased at how I was able 
to use "You Want It When" style macros to accomplish it too!)

BUT it failed miserably (in that I got slower runtimes doing this than 
just using the state lookup directly, or at least they weren't 
significantly faster when run under the interpreter, and under after 
applying mzc to the scheme source, it was definitely slower.

I suspected that creating 10,000 (* 2 ?) procedures was a bad thing to 
do to your instruction cache when each procedure is being mapped to a 
separate bit of C code.  But it could be that I was employing a 
particularly naive code generation strategy.  You can get an idea of 
the technique I used by looking at ant-compilation.scm and 
ant-compilation-helper.scm on the code post link I posted to the list 

In any case, I will *definitely* be looking at your code, after hearing 
this tidbit.


"(Dijkstra, as I'm sure you know, was the
author of 'Gotos Considered Harmful' - a landmark
work in programming methodology, applauded by Pascal
programmers and quiche eaters alike)"  -Real Programmers don't use 

Posted on the users mailing list.