| Deutsch English Français Italiano |
|
<74f2e030895c9c5dbdf233a8f7489c34@www.novabbs.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!news.quux.org!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail
From: mhx@iae.nl (mhx)
Newsgroups: comp.lang.forth
Subject: Re: May the numbers speak
Date: Thu, 12 Jun 2025 08:12:50 +0000
Organization: novaBBS
Message-ID: <74f2e030895c9c5dbdf233a8f7489c34@www.novabbs.com>
References: <20129e22c76a2b18b0a745e9499cbd9b@www.novabbs.com> <73357bfe46cea40d8c795ee213cf77c0a0a53d86@i2pn2.org> <nnd$55b49d7c$79d7df19@18e4748466d95fd5> <102dnba$2frp7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="165843"; mail-complaints-to="usenet@i2pn2.org";
posting-account="J+nubxJRM7ncpF4l6KLO+OONWmFAYJHVJegfwQXJ8vc";
User-Agent: Rocksolid Light
X-Rslight-Site: $2y$10$QEFd4MXZHOt5ZhBh50WHr.Nzb2VLZoZrsLcxyMXgd2wWiRMaEL/Jq
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Rslight-Posting-User: 4e0dc1fdad1ead10b39e7eb5db19bf73d73e3ab3
There may be several issues on a real computer which make
these considerations immaterial:
ANEW -timescan
: dtimescan ( addr count -- d )
over swap + >r >r
0. r> 0
begin
over r@ <
while
over c@ ':'
= if swap >r s>d d+ #60 1 m*/ r> 0
else #10 * over c@ [char] 0 - +
endif
swap 1+ swap
repeat
-r nip s>d d+ ;
: timestrscan ( addr count -- d )
1 1 LOCALS| c6 c1 |
0. 2SWAP
OVER + 1- ?DO
I C@ DUP ':' =
IF DROP
c6 #60 * TO c6
1 TO C1
ELSE '0' - C1 * C6 M* D+
#10 TO C1
ENDIF
-1 +LOOP ;
: TEST ( -- )
CR ." \ dtimescan : " S" 12:34:56" TICKS-RESET dtimescan
TICKS? UD. ." clock ticks elapsed, " UD.
CR ." \ timestrscan : " S" 12:34:56" TICKS-RESET timestrscan
TICKS? UD. ." clock ticks elapsed, " UD. ;
TEST
FORTH> in
\ dtimescan : 1258 clock ticks elapsed, 45296
\ timestrscan : 419 clock ticks elapsed, 45296 ok
FORTH> TEST TEST TEST
\ dtimescan : 1258 clock ticks elapsed, 45296
\ timestrscan : 419 clock ticks elapsed, 45296
\ dtimescan : 419 clock ticks elapsed, 45296
\ timestrscan : 420 clock ticks elapsed, 45296
\ dtimescan : 419 clock ticks elapsed, 45296
\ timestrscan : 420 clock ticks elapsed, 45296
FORTH>
A 'clock tick' is approximately 0.2ns.
-marcel