[colorforth] Ackerman bench mark
- Subject: [colorforth] Ackerman bench mark
- From: Bernd Beuster <bernd.beuster@xxxxxxxx>
- Date: Mon, 06 Aug 2001 11:18:17 +0200
Somewhere in c.l.f. the Ackerman function was posted.
\ Ackerman benchmark
FORTH DEFINITIONS DECIMAL
: ACK ( n1 n2 -- n3 )
DUP 0= IF DROP 1+ EXIT THEN
OVER 0= IF NIP 1 SWAP 1- RECURSE
ELSE SWAP 1- OVER RECURSE SWAP 1- RECURSE THEN ;
: BENCH 999 FOR 6 3 ACK DROP NEXT ;
In colorForth it is:
: ack -1 ? if swap -1 ? if -1 + over ack swap -1 + ack ; then
drop 1 swap -1 + ack ; then drop 1 + ;
: bench time - 6 3 ack drop time + ;
In the c.l.f. posting the parameters were 8 3, but this overuns the
stacks in bigForth and colorForth.
Results in clock cycles (Pentium MMX):
colorForth: 1.65M
bigForth : 4.40M
Gforth : 19.9M
So the ratio is 1 : 2.7 : 12.
--
Bernd
------------------------
To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems - List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site - http://www.colorforth.com