Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #16938

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

From rickman <gnuarm@gmail.com>
Newsgroups comp.lang.forth
Subject Re: GA144 and test the new word "asd" : speed test
Date 2012-10-31 21:29 -0400
Organization A noiseless patient Spider
Message-ID <k6u351$sbp$2@dont-email.me> (permalink)
References <3634564f-07d6-47d6-8e31-aa17f1060f72@googlegroups.com>

Show all headers | View raw


On 10/31/2012 3:38 PM, emmanuel wrote:
> 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

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.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

GA144 and  test the new word "asd"  :  speed test emmanuel <emmanuel.said@cern.ch> - 2012-10-31 12:38 -0700
  Re: GA144 and  test the new word "asd"  :  speed test Howerd <howerdo@yahoo.co.uk> - 2012-11-01 01:13 -0700
  Re: GA144 and  test the new word "asd"  :  speed test rickman <gnuarm@gmail.com> - 2012-10-31 21:29 -0400
    Re: GA144 and  test the new word "asd"  :  speed test "Ed" <invalid@nospam.com> - 2012-11-03 15:42 +1100
  Re: GA144 and  test the new word "asd"  :  speed test David Stubbs <stubbsd@genialgenetics.com> - 2012-11-06 23:28 -0800
    Re: GA144 and  test the new word "asd"  :  speed test emmanuel <emmanuel.said@cern.ch> - 2012-11-06 23:49 -0800
      Re: GA144 and  test the new word "asd"  :  speed test rickman <gnuarm@gmail.com> - 2012-11-08 10:12 -0500

csiph-web