Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]

Liste des GroupesRevenir à cl forth 
Sujet : Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]
De : mhx (at) *nospam* iae.nl (mhx)
Groupes : comp.lang.forth
Date : 14. Sep 2024, 19:54:46
Autres entêtes
Organisation : novaBBS
Message-ID : <90389fea385c08c72f39d4fdef04d076@www.novabbs.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Rocksolid Light
On Sat, 14 Sep 2024 17:41:23 +0000, Ahmed wrote:

On Sat, 14 Sep 2024 17:13:51 +0000, Ahmed wrote:
>
utime 0.1e neg_big utime d- dnegate d.
with locals:    about 19 ms
without locals: about 18 ms
>
Ahmed
Oops.
>
Please read micro seconds (us) instead of milli seconds (ms).
>
with locals:    about 19 us
without locals: about 18 us
That can't be correct.
In iForth I used dfloats instead of floats
( 4.9ns instead of 7.3ns).
Using structs is not a great idea in this case.
anew -testlocals
: tri_mf:  ( f: a b c )
     create frot df, fswap df, df,
     does> ( F: x -- y )
            ( ad_a)           ( f: x)
       dup fdup        ( ad_a ad_a)      ( f: x x)
       df@             ( ad_a)           ( f: x x a)
       f>=             ( ad_a -1|0)      ( f: x)
       over dfloat+    ( ad_a -1|0 ad_b) ( f: x)
       fdup df@        ( ad_a -1|0)      ( f: x x b)
       f< and if       ( ad_a)           ( f: x)
         dup df@ f-    ( ad_a)           ( f: x-a)
         dup df@       ( ad_a)           ( f: x-a a)
         dfloat+       ( ad_b)           ( f: x-a a)
         f@ fswap f-                     ( f: x-a b-a)
         f/                              ( f: [x-a]/[b-a])
         exit
       then
       dfloat+         ( ad_b)           ( f: x)
       dup fdup        ( ad_b ad_b)      ( f: x x)
       df@             ( ad_b)           ( f: x x b)
       f>=             ( ad_b -1|0)      ( f: x)
       over dfloat+    ( ad_b -1|0 ad_c) ( f: x)
       fdup df@        ( ad_b -1|0)      ( f: x x c)
       f< and if       ( ad_b)           ( f: x)
         dup dfloat+ df@ ( ad_b)         ( f: x c)
         f-            ( ad_b)           ( f: x-c)
         dup dfloat+   ( ad_b ad_c)      ( f: x-c)
         swap df@ df@ f-                 ( f: x-c b-c)
         f/                              ( f: [x-c]/[b-c])
         exit
       then
       drop fdrop
       0e
;
-1e309    -1e     0e         tri_mf: nol_neg_big
: (tri_mf) ( f: x a b c -- mv)
FLOCALS| c b a x |
x a f>= x b f< and if x a f- b a f- f/ exit then
x b f>= x c f< and if c x f- c b f- f/ exit then
0e ;
: loc_neg_big -1e309 -1e   0e   (tri_mf) ;
: .timing MS? S>F 1e-3 F*  1e7 F/ F.N2 ." s/call." ;
: tnb CR ." \ no locals: " TIMER-RESET #10000000  ( 1e7 times )
   0 DO  -10e   nol_neg_big FDROP  LOOP .timing
CR ." \    locals: " TIMER-RESET #10000000  ( 1e7 times )
   0 DO  -10e   loc_neg_big FDROP  LOOP .timing ;
FORTH> tnb
\ no locals: 4.9ns/call.
\    locals: 21.3ns/call. ok
-marcel

Date Sujet#  Auteur
30 Aug 24 * Avoid treating the stack as an array [Re: "Back & Forth" is back!]142Buzz McCool
30 Aug 24 +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]9minforth
31 Aug 24 i+- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1BuzzMcCool
2 Sep 24 i+* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]4Buzz McCool
3 Sep 24 ii`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]3dxf
3 Sep 24 ii `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]2Buzz McCool
3 Sep 24 ii  `- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1dxf
11 Sep 24 i+* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]2minforth
11 Sep 24 ii`- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1Hans Bezemer
12 Sep 24 i`- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1dxf
31 Aug 24 `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]132dxf
31 Aug 24  `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]131BuzzMcCool
6 Sep 24   `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]130Buzz McCool
7 Sep 24    +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]123Hans Bezemer
10 Sep 24    i`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]122Paul Rubin
10 Sep 24    i +- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1dxf
11 Sep 24    i +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]117dxf
11 Sep 24    i i`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]116dxf
12 Sep 24    i i `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]115Paul Rubin
12 Sep 24    i i  +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]98dxf
12 Sep 24    i i  i+* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]3minforth
12 Sep 24    i i  ii`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]2mhx
12 Sep 24    i i  ii `- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1minforth
12 Sep 24    i i  i+* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]57Anton Ertl
13 Sep 24    i i  ii`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]56dxf
13 Sep 24    i i  ii `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]55minforth
13 Sep 24    i i  ii  `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]54dxf
13 Sep 24    i i  ii   +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]10Paul Rubin
13 Sep 24    i i  ii   i+* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]2Jan Coombs
13 Sep 24    i i  ii   ii`- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1Anton Ertl
13 Sep 24    i i  ii   i`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]7dxf
14 Sep 24    i i  ii   i `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]6Paul Rubin
14 Sep 24    i i  ii   i  `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]5dxf
14 Sep 24    i i  ii   i   `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]4Paul Rubin
15 Sep 24    i i  ii   i    `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]3dxf
15 Sep 24    i i  ii   i     `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]2Paul Rubin
16 Sep 24    i i  ii   i      `- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1dxf
13 Sep 24    i i  ii   +- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1albert
13 Sep 24    i i  ii   `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]42Anton Ertl
14 Sep 24    i i  ii    `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]41dxf
14 Sep 24    i i  ii     +- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1minforth
14 Sep 24    i i  ii     `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]39Anton Ertl
14 Sep 24    i i  ii      +- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1dxf
15 Sep 24    i i  ii      `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]37Stephen Pelc
15 Sep 24    i i  ii       `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]36Anton Ertl
15 Sep 24    i i  ii        +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]9Stephen Pelc
15 Sep 24    i i  ii        i+* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]7Paul Rubin
16 Sep 24    i i  ii        ii`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]6Stephen Pelc
16 Sep 24    i i  ii        ii +- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1minforth
16 Sep 24    i i  ii        ii `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]4Anton Ertl
16 Sep 24    i i  ii        ii  `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]3mhx
16 Sep 24    i i  ii        ii   `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]2Anton Ertl
17 Sep 24    i i  ii        ii    `- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1mhx
16 Sep 24    i i  ii        i`- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1Anton Ertl
27 Sep 24    i i  ii        `* value-flavoured structures (was: Avoid treating the stack as an array)26Ruvim
27 Sep 24    i i  ii         +* Re: value-flavoured structures15minforth
27 Sep 24    i i  ii         i+- Re: value-flavoured structures1mhx
27 Sep 24    i i  ii         i`* Re: value-flavoured structures13Ruvim
27 Sep 24    i i  ii         i `* Re: value-flavoured structures12minforth
27 Sep 24    i i  ii         i  +* Re: value-flavoured structures8Ruvim
28 Sep 24    i i  ii         i  i+* Re: value-flavoured structures6Paul Rubin
28 Sep 24    i i  ii         i  ii+* Re: value-flavoured structures2dxf
28 Sep 24    i i  ii         i  iii`- Re: value-flavoured structures1Paul Rubin
28 Sep 24    i i  ii         i  ii`* Re: value-flavoured structures3albert
28 Sep 24    i i  ii         i  ii `* Re: value-flavoured structures2Paul Rubin
28 Sep 24    i i  ii         i  ii  `- Re: value-flavoured structures1Paul Rubin
28 Sep 24    i i  ii         i  i`- Re: value-flavoured structures1dxf
3 Oct 24    i i  ii         i  `* Re: value-flavoured structures3Anton Ertl
4 Oct 24    i i  ii         i   `* Re: value-flavoured structures2dxf
4 Oct 24    i i  ii         i    `- Re: value-flavoured structures1albert
3 Oct 24    i i  ii         `* Re: value-flavoured structures (was: Avoid treating the stack as an array)10Anton Ertl
4 Oct 24    i i  ii          `* Re: value-flavoured structures9Ruvim
4 Oct 24    i i  ii           `* Re: value-flavoured structures8Anton Ertl
4 Oct 24    i i  ii            `* Re: value-flavoured structures7Ruvim
4 Oct 24    i i  ii             `* Re: value-flavoured structures6Anton Ertl
5 Oct 24    i i  ii              `* Re: value-flavoured structures5Ruvim
5 Oct 24    i i  ii               `* Re: value-flavoured structures4Anton Ertl
6 Oct 24    i i  ii                +- value-flavoured properties of a word (was: value-flavoured structures)1Ruvim
6 Oct 24    i i  ii                +- value-flavoured approach (was: value-flavoured structures)1Ruvim
6 Oct 24    i i  ii                `- value-flavoured approach in API (was: value-flavoured structures)1Ruvim
14 Sep 24    i i  i`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]37Anton Ertl
14 Sep 24    i i  i +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]34Ahmed
14 Sep 24    i i  i i+* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]32Anton Ertl
14 Sep 24    i i  i ii`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]31Ahmed
14 Sep 24    i i  i ii +- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1Ahmed
14 Sep 24    i i  i ii +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]7Ahmed
14 Sep 24    i i  i ii i`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]6mhx
14 Sep 24    i i  i ii i +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]4Ahmed
15 Sep 24    i i  i ii i i`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]3minforth
15 Sep 24    i i  i ii i i `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]2Ahmed
15 Sep 24    i i  i ii i i  `- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1Ahmed
15 Sep 24    i i  i ii i `- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1albert
15 Sep 24    i i  i ii `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]22dxf
15 Sep 24    i i  i ii  +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]16Ahmed
15 Sep 24    i i  i ii  i`* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]15mhx
15 Sep 24    i i  i ii  i `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]14ahmed
16 Sep 24    i i  i ii  i  `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]13Ahmed
16 Sep 24    i i  i ii  i   `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]12mhx
16 Sep 24    i i  i ii  i    +- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1Ahmed
16 Sep 24    i i  i ii  i    +* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]3dxf
16 Sep 24    i i  i ii  i    i+- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1Ahmed
16 Sep 24    i i  i ii  i    i`- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1mhx
16 Sep 24    i i  i ii  i    `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]7Paul Rubin
15 Sep 24    i i  i ii  `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]5Paul Rubin
15 Sep 24    i i  i i`- Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]1albert
15 Sep 24    i i  i `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]2dxf
12 Sep 24    i i  `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]16Anton Ertl
11 Sep 24    i `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]3Hans Bezemer
8 Sep 24    `* Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]6Stephen Pelc

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal