Sujet : Re: OOS approach revisited
De : dxforth (at) *nospam* gmail.com (dxf)
Groupes : comp.lang.forthDate : 24. Jun 2025, 14:28:13
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <84d259e0f1d6210d84c7840af5d51f4ebdd71ed4@i2pn2.org>
References : 1
User-Agent : Mozilla Thunderbird
On 23/06/2025 3:09 pm, LIT wrote:
1 VARIABLE X
2 VARIABLE Y
3 VARIABLE Z
: TEST1 1000 0 DO 10000 0 DO X @ Y @ + Z ! LOOP LOOP ; ok
: TEST2 1000 0 DO 10000 0 DO X Y Z +> LOOP LOOP ; ok
TICKS TEST1 TICKS 2SWAP DMINUS D+ D. 121 ok
TICKS TEST2 TICKS 2SWAP DMINUS D+ D. 71 ok
: TEST1 1000 0 DO 10000 0 DO 1 X +! 1 Y +! X @ Y @ + Z ! LOOP LOOP ;
ok
: TEST2 1000 0 DO 10000 0 DO X ++ Y ++ X Y Z +> LOOP LOOP ; ok
TICKS TEST1 TICKS 2SWAP DMINUS D+ D. 217 ok
TICKS TEST2 TICKS 2SWAP DMINUS D+ D. 132 ok
'+>' moves a sum of two variables into body of the third one.
The results are rather promising, from one can see.
The saving come from rolling @ @ + ! into a single very specialized
function. But what about the loading of X Y and retrieving of Z which
are unavoidable in practice? Should that not be included in the test?