Hi! As a course work I had to write something and I decided to write about speed of AmForth. Sorry it is in Finnish but I could share it after I've finished the task. At least the tables are readable:)
I have test program in AmForth 5.2. It isn't fastest but it is simple enough.
: test-speed ( -- )
test-pin pin\_output
begin
test-pin high
test-pin low
test-pin high
test-pin low
again
;
running it gives about 20kHz signal on 20MHz AtMega328p where CKOUT is on
PORTB0 and each up and down lasts about 500 clock cycles. I can even see the
(branch) on low time.
Now the interesting part. I started to read lst file. I SEEed the definitions
and wrote down words until I had only primitives.
The table of my results are below. If looked, it can be seen that pulse should
last 126+160 or 126+176
: has DO_COLON and ; has exit and DO_NEXT counted. There shouldn't be any
interrupts, except from serial which don't come as I'm idling terminal. What I
have missed? My calculations are about half of the real life output.
Below is hopefully some kind of table.
Best regards,
Hannu Vuolasaho
testpin
:
dup
@i
swap
”1+
@i
;
7
18
22
23
16
22
18
126
high
:
dup
c@
rot
or
swap
c!
;
7
18
18
31
20
23
25
18
160
low
:
dup
c@
rot
invert
and
swap
c!
;
7
18
18
31
16
20
23
25
18
176
Speed-test
testpin
high
testpin
low
testpin
high
testpin
low
(branch)
126
160
126
176
126
160
126
176
23
1199
------------------------------------------------------------------------------
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
[email protected]
https://lists.sourceforge.net/lists/listinfo/amforth-devel
