(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 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 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 ) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)