Article View: comp.lang.forth
Article #48Re: Pairwise dot product
From: Anton Ertl
Date: Fri, 09 Oct 2026 10:37
Date: Fri, 09 Oct 2026 10:37
48 lines
2940 bytes
2940 bytes
marcel hendrix <mhx@iae.nl> writes:
>Strange. I changed fourth and third to what I suppose is worse code, but
>\ V* : 2,598,357,958 clock ticks
>\ naive-V* : 2,596,436,412 clock ticks
>\ pairwise-V* : 2,286,386,056 clock ticks
>
>Now pairwise-V* wins.
>
>fourth and third became:
>
>: fourth ( a b c d -- a b c d a ) >S >S OVER S> S> ROT ;
>: third ( a b c -- a b c a ) >S OVER S> SWAP ;
>
>... which looks bad, but which generates
>
>FORTH> ' v*2 idis
>$01344740 : v*2
>$0134474A pop rbx
>$0134474B pop rdi
>$0134474C fld [rbx] qword
>$0134474E fld [rdi] qword
>$01344750 fmulp ST(1), ST
>$01344752 pop rax
>$01344753 pop rdx
>$01344754 fld [rbx rax*1] qword
>$01344757 fld [rdx rdi*1] qword
>$0134475A fmulp ST(1), ST
>$0134475C faddp ST(1), ST
>$0134475E fpush,
>$01344768 push rdx
>$01344769 push rax
>$0134476A lea rdi, [rdi rdx*2] qword
>$0134476E push rdi
>$0134476F lea rbx, [rbx rax*2] qword
>$01344773 push rbx
>$01344774 ;
Nice. I tried these definitions of FOURTH and THIRD on the iforth I
have installed, but the resulting code does not work, so I did not
measure iforth on my system with these definitions of FOURTH and
THIRD.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
Technical Details
Message-ID:
<2026Oct9.123752@mips.complang.tuwien.ac.at>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<2026Oct8.175513@mips.complang.tuwien.ac.at> <11a9aah$19g75$1@dont-email.me> <2026Oct9.073240@mips.complang.tuwien.ac.at> <11aa44u$9s7j$1@dont-email.me> <2026Oct9.092016@mips.complang.tuwien.ac.at> <11aa9kv$9va2$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.lang.forth Subject: Re: Pairwise dot product Date: Fri, 09 Oct 2026 10:37:52 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 48 Message-ID: <2026Oct9.123752@mips.complang.tuwien.ac.at> References: <2026Oct8.175513@mips.complang.tuwien.ac.at> <11a9aah$19g75$1@dont-email.me> <2026Oct9.073240@mips.complang.tuwien.ac.at> <11aa44u$9s7j$1@dont-email.me> <2026Oct9.092016@mips.complang.tuwien.ac.at> <11aa9kv$9va2$1@dont-email.me> Injection-Date: Fri, 09 Oct 2026 10:43:40 +0000 (UTC) Injection-Info: dont-email.me; logging-data="711394"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OjDMzmIDT8vC2K2fV3Qjn"; posting-host="e8d347a9092f3e963a34721c3f889ca2" Cancel-Lock: sha1:e8mVtNFK2wpR3UP7G4uW9pUTDgY= sha256:aEITvU0a4y1As0fX2vYNHd4tSV8XDZZPZgnlMha9tdE= sha1:etpaiSUkN17qQVbkHa1l0IMvrck= sha256:lSL7EHftl6ijJ55KRjGEc4MdMGI7clGFjkEpqVJB8u4= X-newsreader: xrn 10.11