Sujet : Re: May the numbers speak - supplement
De : mhx (at) *nospam* iae.nl (mhx)
Groupes : comp.lang.forthDate : 13. Jun 2025, 09:43:44
Autres entêtes
Organisation : novaBBS
Message-ID : <7833daedd900cdce052246e4d5e5b6c9@www.novabbs.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12
User-Agent : Rocksolid Light
On Thu, 12 Jun 2025 22:01:07 +0000, Paul Rubin wrote:
mhx@iae.nl (mhx) writes:
iSPICE> TEST TEST TEST TEST
\ dtimescan : 2515 clock ticks elapsed, 45296
\ timestrscan : 419 clock ticks elapsed, 45296
\ HMS : 419 clock ticks elapsed, 45296
It makes no difference. Whatever is holding it down must
be quite severe.
>
Is dtimescan the one that uses double word arithmetic for 16 bit
processors? It's doing more stuff, I would think. Weird that it
catches up after a few tries. Cache warming?
The TICKS? word apparently can't be trusted under Windows 11. This
is better:
#2000000 VALUE #iters
CREATE num ," 12:34:56"
: .SECS MS? #1000000 #iters 3 * */ ." / " . ." ns per iteration." ;
: TEST2 ( -- )
CR
CR ." \ dtimescan : " TIMER-RESET num C@+
#iters 0 ?DO 2DUP dtimescan 2DROP
2DUP dtimescan 2DROP
2DUP dtimescan 2DROP LOOP dtimescan UD. SECS
CR ." \ timestrscan : " TIMER-RESET num C@+
#iters 0 ?DO 2DUP timestrscan 2DROP
2DUP timestrscan 2DROP
2DUP timestrscan 2DROP LOOP timestrscan UD. SECS
CR ." \ HMS : " TIMER-RESET num C@+
#iters 0 ?DO 2DUP hms DROP
2DUP hms DROP
2DUP hms DROP LOOP hms . SECS
CR ." \ HMS2 : " TIMER-RESET num C@+
#iters 0 ?DO 2DUP hms2 3DROP
2DUP hms2 3DROP
2DUP hms2 3DROP LOOP hms2 ROT . SWAP . . SECS ;
CLS TEST2 TEST2 TEST2 TEST2
\ dtimescan : 45296 / 15 ns per iteration.
\ timestrscan : 45296 / 13 ns per iteration.
\ HMS : 45296 / 5 ns per iteration.
\ HMS2 : 12 34 56 / 53 ns per iteration.
\ dtimescan : 45296 / 15 ns per iteration.
\ timestrscan : 45296 / 14 ns per iteration.
\ HMS : 45296 / 5 ns per iteration.
\ HMS2 : 12 34 56 / 53 ns per iteration.
\ dtimescan : 45296 / 16 ns per iteration.
\ timestrscan : 45296 / 14 ns per iteration.
\ HMS : 45296 / 5 ns per iteration.
\ HMS2 : 12 34 56 / 53 ns per iteration.
\ dtimescan : 45296 / 15 ns per iteration.
\ timestrscan : 45296 / 14 ns per iteration.
\ HMS : 45296 / 5 ns per iteration.
\ HMS2 : 12 34 56 / 53 ns per iteration. ok
HMS is three times faster than dtimescan and timestrscan, while
HMS2 is 3.5 times slower (as expected).
In practice, I'd use some variant of hms2.
-marcel