Post Reply 
(71B) FORTH questions
07-27-2023, 11:20 PM (This post was last modified: 07-28-2023 10:19 PM by Garth Wilson.)
Post: #48
RE: (71B) FORTH questions
(07-27-2023 08:05 AM)floppy Wrote:  Is there any overview anywhere how many 0.01s few forth commands are consuming? example
SWAP SWAP (no effect at all on the stack).

Many of the Forth words seemed to have been written a lazy way of just handing them off to BASIC and then returning the effects, along with all the overhead of doing so, and I have said before that I was able to speed up many of the Forth words, often dramatically, by re-writing, them, not even resorting to assembly language.  CHR$ was the greatest as I remember, at 14x, going from 13.5ms to under 1ms.  Bob Prosperi has asked me to write these up, but it turned out to be a huge job, because my documentation is not all in one place, nor organized, and partly because I have hardly touched my 71's in a couple of decades or more, so I would need a lot of review to refresh my mind on how to use the 71.  Consequently, I have not succeeded so far in writing this stuff up.

However, here are a few timings I have penciled in in the manual for the 82441A Forth module:
"    4ms for 1 character, no noticeable increase for 11 characters
*     multiplying 123H by 45H took 2.73ms, and 1 x 1 took 1.88ms
+     (also - ) 0.3ms
+!     370µs
-TRAILING     on a string of ABCDEFGHIJKL took 5.54ms
0     260µs
0<     270µs
0=     about 265µs
0>     about 275µs
1/X     about 7ms
2     220µs
2*     (also 2/ ) about 325µs
2+     (also 2- and 5+ and 5- ) 250µs
2DROP     215µs
2DUP     235µs
2OVER     255µs
2SWAP     0.37ms
4N@     1.9ms
<     5  A  <  took 315µs, and  A  5  -  took 335µs
=     280µs
>     5  A  >  took 330µs, and  A  5  >  took 352µs
>R     >R  R>  takes 0.6ms
@     285µs
ABS     170µs for n>=0, 200µs for n<0
AND     255µs
ASC     1.59ms
You can do BEGIN...AGAIN about 330µs per loop faster than BEGIN  -1  UNTIL if you define:
Code:
: AGAIN  ?comp  1 ?PAIRS  branch  HERE -  ,  ;  IMMEDIATE
BL     256µs
C!     336µs
C@     290µs
C@+     about 4.6ms
CHR@     13.5ms
CMOVE     moving 10 characters took about 1.4ms
CONSTANT     260µs to return a constant by referring to it after it's created
COUNT     324µs
DECIMAL     almost 2ms!
DO...+LOOP     DO  10  +LOOP  took about 1.75ms per loop.
DO...LOOP     An empty DO LOOP loops about a thousand times per second.
DROP     200µs
DUP     218µs
END$     by itself took 54ms when used in " ABCDEFGHIJKL"  W$  S!  5  END$ LEFT$ and RIGHT$ were about the same.
HEX     took almost 2ms!
I     261µs
IF...THEN     0  IF  THEN  takes about 1.2ms.  -1  IF  THEN  takes about 1.1ms.
J     273µs
M*     by itself took an average of 6ms when used in  HEX  1000  0  DO  M*  LOOP
M/     by itself took an average of 15.44ms when used in  HEX  1000  0  DO  12345  M/  LOOP
MAX     (and also MIN) about 4ms
MAXLEN     2.12ms
N@     271µs
NOT     240µs
NULL$     8.79ms!
OVER     230µs
PICK     4  PICK  took 330µs
ROT     375µs
S!     a 9-character string took 10.15ms
S<&     concatenating a 10-character string and a 9-character string took 13.2ms
S=     In " ABCDEFGHI"  2DUP  W$  S!  WHO$  S!  W$  WHO$  S=, the S= took 2.55ms; but replacing WHO$ with just a letter A, S= took 1.173ms.
S>&     Concatenating " JKLMNOPQRS" and " ABCDEFGHI" took 16.08ms.
STRING     Returning str after creation takes 350µs.
SUB$     In " ABCDEFGHIJK"  W$  S!  W$  5  7  SUB$, the SUB$ took 52ms.
SWAP     about 300µs
VAL     48ms
VARIABLE     After a variable is created, returning its address takes 222µs.

http://WilsonMinesCo.com  (Lots of HP-41 links at the bottom of the links page, at http://wilsonminesco.com/links.html#hp41 )
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(71B) FORTH questions - floppy - 05-29-2023, 04:13 PM
RE: (71B) FORTH questions - rprosperi - 05-29-2023, 04:52 PM
RE: (71B) FORTH questions - floppy - 05-29-2023, 07:58 PM
RE: (71B) FORTH questions - rprosperi - 05-30-2023, 12:29 AM
RE: (71B) FORTH questions - floppy - 05-30-2023, 02:07 PM
RE: (71B) FORTH questions - floppy - 05-30-2023, 04:05 PM
RE: (71B) FORTH questions - floppy - 05-30-2023, 04:39 PM
RE: (71B) FORTH questions - rprosperi - 05-30-2023, 07:42 PM
RE: (71B) FORTH questions - floppy - 05-31-2023, 06:50 AM
RE: (71B) FORTH questions - rprosperi - 05-31-2023, 12:18 PM
RE: (71B) FORTH questions - J-F Garnier - 05-31-2023, 01:00 PM
RE: (71B) FORTH questions - rprosperi - 05-31-2023, 10:26 PM
RE: (71B) FORTH questions - floppy - 05-31-2023, 12:42 PM
RE: (71B) FORTH questions - floppy - 05-31-2023, 02:25 PM
RE: (71B) FORTH questions - J-F Garnier - 05-31-2023, 04:00 PM
RE: (71B) FORTH questions - floppy - 05-31-2023, 07:55 PM
RE: (71B) FORTH questions - floppy - 06-15-2023, 07:34 PM
RE: (71B) FORTH questions - rprosperi - 06-16-2023, 03:22 AM
RE: (71B) FORTH questions - floppy - 06-16-2023, 01:53 PM
RE: (71B) FORTH questions - J-F Garnier - 06-16-2023, 04:01 PM
RE: (71B) FORTH questions - rprosperi - 06-17-2023, 01:52 AM
RE: (71B) FORTH questions - J-F Garnier - 06-16-2023, 02:20 PM
RE: (71B) FORTH questions - floppy - 06-16-2023, 05:27 PM
RE: (71B) FORTH questions - J-F Garnier - 06-16-2023, 08:12 PM
RE: (71B) FORTH questions - floppy - 06-19-2023, 08:09 PM
RE: (71B) FORTH questions - Sylvain Cote - 06-19-2023, 09:16 PM
RE: (71B) FORTH questions - David Hayden - 07-25-2023, 06:05 PM
RE: (71B) FORTH questions - J-F Garnier - 07-25-2023, 06:38 PM
RE: (71B) FORTH questions - mfleming - 06-19-2023, 09:08 PM
RE: (71B) FORTH questions - floppy - 06-20-2023, 10:31 AM
RE: (71B) FORTH questions - floppy - 08-21-2024, 09:23 AM
RE: (71B) FORTH questions - rprosperi - 08-21-2024, 11:54 AM
RE: (71B) FORTH questions - rprosperi - 06-20-2023, 02:15 AM
RE: (71B) FORTH questions - KimH - 06-20-2023, 07:41 PM
RE: (71B) FORTH questions - rprosperi - 06-20-2023, 09:30 PM
RE: (71B) FORTH questions - Sylvain Cote - 06-21-2023, 12:03 AM
RE: (71B) FORTH questions - J-F Garnier - 06-21-2023, 07:00 AM
RE: (71B) FORTH questions - floppy - 06-22-2023, 05:13 PM
RE: (71B) FORTH questions - rprosperi - 06-22-2023, 06:51 PM
RE: (71B) FORTH questions - floppy - 10-19-2023, 05:01 PM
RE: (71B) FORTH questions - floppy - 06-03-2024, 08:49 PM
RE: (71B) FORTH questions - Sylvain Cote - 06-04-2024, 02:06 AM
RE: (71B) FORTH questions - rprosperi - 06-04-2024, 02:10 AM
RE: (71B) FORTH questions - Sylvain Cote - 06-22-2023, 07:53 PM
RE: (71B) FORTH questions - floppy - 07-31-2023, 03:41 PM
RE: (71B) FORTH questions - Sylvain Cote - 07-31-2023, 07:21 PM
RE: (71B) FORTH questions - floppy - 06-17-2024, 02:23 PM
RE: (71B) FORTH questions - rprosperi - 06-18-2024, 02:57 AM
RE: (71B) FORTH questions - Garth Wilson - 06-18-2024, 04:29 AM
RE: (71B) FORTH questions - floppy - 06-18-2024, 09:42 AM
RE: (71B) FORTH questions - floppy - 07-25-2023, 02:36 PM
RE: (71B) FORTH questions - Sylvain Cote - 07-25-2023, 03:02 PM
RE: (71B) FORTH questions - floppy - 07-25-2023, 03:52 PM
RE: (71B) FORTH questions - floppy - 07-26-2023, 05:02 PM
RE: (71B) FORTH questions - rprosperi - 07-26-2023, 08:17 PM
RE: (71B) FORTH questions - floppy - 07-27-2023, 08:05 AM
RE: (71B) FORTH questions - Garth Wilson - 07-27-2023 11:20 PM
RE: (71B) FORTH questions - floppy - 08-01-2023, 10:10 AM
RE: (71B) FORTH questions - HP67 - 08-01-2023, 10:12 AM
RE: (71B) FORTH questions - floppy - 08-01-2023, 11:11 AM
RE: (71B) FORTH questions - rprosperi - 08-01-2023, 12:29 PM
RE: (71B) FORTH questions - Sylvain Cote - 08-01-2023, 12:44 PM
RE: (71B) FORTH questions - floppy - 08-01-2023, 01:03 PM
RE: (71B) FORTH questions - Sylvain Cote - 08-01-2023, 01:25 PM
RE: (71B) FORTH questions - floppy - 08-01-2023, 02:33 PM
RE: (71B) FORTH questions - Sylvain Cote - 08-01-2023, 03:14 PM
RE: (71B) FORTH questions - floppy - 08-01-2023, 03:46 PM
RE: (71B) FORTH questions - rprosperi - 08-01-2023, 04:53 PM
RE: (71B) FORTH questions - Sylvain Cote - 08-01-2023, 04:55 PM
RE: (71B) FORTH questions - rprosperi - 08-01-2023, 06:29 PM
RE: (71B) FORTH questions - Sylvain Cote - 08-01-2023, 06:48 PM
RE: (71B) FORTH questions - floppy - 09-08-2023, 04:18 PM
RE: (71B) FORTH questions - Sylvain Cote - 09-08-2023, 05:39 PM
RE: (71B) FORTH questions - floppy - 09-12-2023, 01:33 PM
RE: (71B) FORTH questions - Sylvain Cote - 09-12-2023, 06:39 PM
RE: (71B) FORTH questions - KeithB - 09-12-2023, 06:26 PM
RE: (71B) FORTH questions - floppy - 09-21-2023, 10:21 AM
RE: (71B) FORTH questions - rprosperi - 09-21-2023, 02:53 PM
RE: (71B) FORTH questions - floppy - 09-22-2023, 09:33 AM
RE: (71B) FORTH questions - rprosperi - 09-22-2023, 12:00 PM
RE: (71B) FORTH questions - floppy - 10-01-2023, 11:21 AM
RE: (71B) FORTH questions - rprosperi - 10-01-2023, 11:49 AM
RE: (71B) FORTH questions - floppy - 10-01-2023, 12:25 PM
RE: (71B) FORTH questions - rprosperi - 10-01-2023, 02:41 PM
RE: (71B) FORTH questions - floppy - 10-17-2023, 09:21 AM
RE: (71B) FORTH questions - floppy - 10-17-2023, 11:28 AM
RE: (71B) FORTH questions - floppy - 10-17-2023, 11:38 AM
RE: (71B) FORTH questions - rprosperi - 10-20-2023, 02:11 AM
RE: (71B) FORTH questions - floppy - 10-20-2023, 07:45 AM
RE: (71B) FORTH questions - Sylvain Cote - 10-20-2023, 11:56 AM
RE: (71B) FORTH questions - rprosperi - 10-20-2023, 12:32 PM
RE: (71B) FORTH questions - Sylvain Cote - 10-20-2023, 03:46 PM
RE: (71B) FORTH questions - floppy - 07-03-2024, 09:31 AM
RE: (71B) FORTH questions - rprosperi - 07-03-2024, 11:47 AM
RE: (71B) FORTH questions - brouhaha - 07-05-2024, 08:07 AM
RE: (71B) FORTH questions - rprosperi - 07-05-2024, 11:56 AM



User(s) browsing this thread: 5 Guest(s)