Rick,
Here is a test sequence about ":noname / : named " definitions....
Charles
\ _TEST FROM HERE_
EMPTY
: nsec ( -- n ) time&date 1999 - \ min second count from 1/1/1999
[ 12 31 * 24 * 3600 * ] literal * >r
[ 31 24 * 3600 * ] literal * r> + >r
[ 24 3600 * ] literal * r> + >r
3600 * rot + swap 60 * + r> + ;
0 value nsec-start
: [t nsec to nsec-start ; immediate
: t] nsec nsec-start - . ; immediate
variable va variable vb
: a 0 va ! va @ vb ! 1 vb ! vb @ va ! ;
: act a a a a a ;
: loop0 0 ?DO act LOOP ;
: loop1 0 ?DO i loop0 LOOP ;
0 value ntime
: evalcomputer
2
BEGIN
nsec over loop1 nsec swap - 5 >
IF to ntime exit THEN
2*
AGAIN ;
cr
..( Timing evaluation... wait max 15 sec... )
cr
..( time elapsed ) [t evalcomputer t]
cr
..( now, the same with some :noname... )
variable va variable vb
:noname 0 va ! va @ vb ! 1 vb ! vb @ va ! ; value ^a
:noname [ ^a compile, ^a compile, ^a compile, ^a compile, ^a compile, ] ; value ^act
:noname 0 ?DO [ ^act compile, ] LOOP ; value ^loop0
:noname 0 ?DO i [ ^loop0 compile, ] LOOP ; value ^loop1
[t ntime ^loop1 execute t] cr
cr .( on my pentium 300, result is near 11 / 7 ... )
cr .( in my class system wich align some word-xt table, result is 10 / 5 )
cr .( In all cases, the "noname" version is really faster ! )
cr .( NB: no ALIGN in this test )
cr
\ Last line here
.
Received on Tue Feb 16 1999 - 19:48:47 PST
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.