[Icfp04-discuss] simulator speed

Jed Davis jdev+icfp at xlerb.net
Tue Jun 15 00:39:42 EDT 2004


Jed Davis <icfp at jdev.users.panix.com> writes:

> Mine takes about a minute to do a pair of 100000-round matches; it's
> running under gforth 0.6.2 on a 1 GHz VIA C3.  I really haven't spent
> any time on optimizing, though.

Now, however, I have.  My third ant interpreter[*], running on an 800
MHz PowerPC 750 ("G3"), takes about .5s to .6s per 100,000-round
match, with no output other than a basic points/food/kills scoreboard
at the end of the match.  (That's for ants that people actually
submitted; with sample.ant it's upwards of .7s for some reason.)

It's written in C with the GNU extension for computed goto, which is
used shamelessly.  There are no explicit tests for an ant's resting or
being dead, or even for the end of the ant array, as these conditions
are all handled by creative (ab)use of instruction dispatch.  Also,
following the thread here on ant optimization, I converted "Sense X Y
Y Z" into "NoOp Y" and "Flip X Y Y" into "Flip 1 Y Y" (note that a
NoOp here is a bad idea, if you want strict compliance) in the reader,
and also made a fast path for power-of-two flips (yes, this did matter
somewhat, and note that 1==2**0).



[*] The one I used during the contest proper being the first; the
second was an agglomeration of C++ that, while it did work correctly,
at one point broke GCC 3.3's parser and is generally best forgotten.

-- 
dn: cn=Jed Davis, o=panix.com  ##          see also jldavis at cs.oberlin.edu
objectclass: person
mail;personal: jdev at panix.com  ##    PGP Key FP:   A098 903E 9B9A DEF4 168F
mail;work:     jld@/           ##  [id 0xF33659F9] AA09 BF07 807E F336 59F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: not available
Url : http://lists.seas.upenn.edu/pipermail/icfp04-discuss/attachments/20040614/911b5ec5/attachment.bin


More information about the Icfp04-discuss mailing list