Sujet : Re: May the numbers speak - supplement
De : mhx (at) *nospam* iae.nl (mhx)
Groupes : comp.lang.forthDate : 12. Jun 2025, 22:22:01
Autres entêtes
Organisation : novaBBS
Message-ID : <784c4c9e2f2586eb6d7df5210ecca689@www.novabbs.com>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Rocksolid Light
On Thu, 12 Jun 2025 20:42:27 +0000, Paul Rubin wrote:
mhx@iae.nl (mhx) writes:
It doesn't do the same thing. It isn't faster, which points out
the '60 *' and 'M* D+' are not the limiting factors.
>
Oh I copied the interface from another post, didn't realize it was
supposed to convert to seconds. I didn't care about the speed since any
slowness in any of these versions can be blamed on the compiler ;).
Here is another version:
>
variable p
: advance 1 p +! ;
: digit ( -- n ) p @ c@ '0' - advance ;
: 2digit ( -- n ) digit 10 * digit + advance ; \ skips trailing colon
: hms ( a u -- n ) drop p ! 2digit 60 * 2digit + 60 * 2digit + ;
: test clearstack s" 12:34:56" hms ;
>
test .s
iSPICE> TEST TEST TEST TEST
\ dtimescan : 2515 clock ticks elapsed, 45296
\ timestrscan : 419 clock ticks elapsed, 45296
\ HMS : 419 clock ticks elapsed, 45296
\ dtimescan : 419 clock ticks elapsed, 45296
\ timestrscan : 420 clock ticks elapsed, 45296
\ HMS : 420 clock ticks elapsed, 45296
\ dtimescan : 838 clock ticks elapsed, 45296
\ timestrscan : 419 clock ticks elapsed, 45296
\ HMS : 419 clock ticks elapsed, 45296
\ dtimescan : 419 clock ticks elapsed, 45296
\ timestrscan : 419 clock ticks elapsed, 45296
\ HMS : 419 clock ticks elapsed, 45296 ok
It makes no difference. Whatever is holding it down must
be quite severe.
-marcel