Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GA144 and test the new word "asd" : speed test

182 views
Skip to first unread message

emmanuel

unread,
Oct 31, 2012, 3:38:55 PM10/31/12
to
Hi,

In the comp lang forth , you have a result of speed test about ": asd"
, see "Ga144 polyforth".

3 seconds whith Polyforth (the same with eForth).

I'm very happy to test the new word asd with my favourite GA144.

: asd 1000 for 1000 for 0 drop next next;

the result is 15ms !!!!

you can see my web page, so it's in French but you can understand except Gavino.


http://esaid.free.fr/tutoriel_arrayforth/Ga144_asd/asd_GA144.htm


Best regards

Emmanuel

Howerd

unread,
Nov 1, 2012, 4:13:18 AM11/1/12
to
Hi Emmanuel,

Excellent! 15ms means that the F18 runs Forth primitives at ~66.6MHz :-)

One of the reasons I wanted polyForth or eForth is for the multi-tasker, but with the GA144 maybe I don't need it, because it is multi-core.
It requires a different way of thinking...

Thanks for sharing this,

Best regards,
Howerd

rickman

unread,
Oct 31, 2012, 9:29:20 PM10/31/12
to
Hi Emmanuel,

Have you done any work with your board? I'd like to hear about it.

Here is a test of my knowledge of the GA144 instruction set. At first
pass, I expect the machine code produced by your source was

@p push . .
1000 (literal data)
outerloop:
@p push . .
1000 (literal data)
@p drop unext .
0 (literal data)
next outerloop

The inner loop (@p drop unext) would take (5 + 1.4 + 2.4) or 7.8 ns or
7.8 us for the total inner loop. The outer loop only adds some 15 ns to
this time for an estimated <8 ms total time.

One important side effect is that this code won't work! Each time
through the inner loop when the literal 0 is accessed the PC will be
incremented and when the loop is exited it will be 999 words past the
location closing the outer loop. So you can't use a literal in a unext
loop.

One fix it to use a different way to get the literal 0. The data stack
could be initialized to all 0s before the loop is entered with one
literal and 9 dups. Then the code could just do the drop, but that is
not really in the spirit of the benchmark. Otherwise the instructions
DUP DUP OR could be used to generate a 0 from whatever is on the stack.
But then the loop would be five opcodes meaning you can't use a unext
loop. Fastest would be to store a 0 in the A register, then it could be
retrieved with the a instruction as
a drop unext .

This would be only 5.2 ns per inner loop or <6 ms for the full
benchmark. Obviously what was done was to use the much slower and
larger next rather than the micronext instruction.

@p push . .
1000 (literal data)
outerloop:
@p push . .
1000 (literal data)
innerloop:
@p drop . .
0 (literal data)
next innerloop
next outerloop

Now the PC gets reset to the correct place every time through the loop
and the literal is read correctly. But the timing is... (5 + 1.4 + 1.4
+ 1.4 + 1.2 + 5.2) or 15.6 ns or nearly 16 ms total which is about what
you measured.

Unfortunately this benchmark does not show the GA144 running at optimal
speed which is three times faster. But to get that sort of optimal
utility takes a lot of work to learn how and to do such optimizations.

Rick

PS Gavino means well, he is just a misguided youth.

Ed

unread,
Nov 3, 2012, 12:42:02 AM11/3/12
to
rickman wrote:
> ...
> Unfortunately this benchmark does not show the GA144 running at optimal
> speed which is three times faster. But to get that sort of optimal
> utility takes a lot of work to learn how and to do such optimizations.

Also to know when the effort is not justified. There may be reasons
other than speed for wishing to run Eforth or PolyForth on a GA chip.
One would need to ask the folks who implemented them and the
intended audience.

One hesitates to draw any conclusion from benchmarks involving
[nearly] empty loops. Except possibly the futility of them.





David Stubbs

unread,
Nov 7, 2012, 2:28:16 AM11/7/12
to
Hi Emmanuel,

I believe the inner loop could be changed to micro next (unext), might save a little time?

: asd 1000 for 1000 for 0 drop unext next ;

Kind Regards,

David.

emmanuel

unread,
Nov 7, 2012, 2:49:49 AM11/7/12
to
Hi David,

it's interesting but you can't use a literal in a unext loop (see the answer to rickman , thank's a lot).
the new word like this seem working :

:asd 1000 for 1000 for dup dup or drop next next ;


cheers

Emmanuel

rickman

unread,
Nov 8, 2012, 10:12:01 AM11/8/12
to
If you wanted to optimize this for speed in the way Chuck would do it,
try this...

: asd 1000 dup dup dup dup dup dup dup dup \ nearly fill stack
for for dup or drop unext next ;

This may be different from the benchmark, but it will give you the
fastest speed and is valid in the sense of measuring the time for the
fastest loop possible with this machine. The only thing that would
speed this code is to reduce the code inside the inner loop. Also note
that the code in the inner loop can't be any longer either... you can
only have four instructions including the unext.

Rick
0 new messages