Article View: comp.lang.forth
Article #42Re: Pairwise dot product
From: Anton Ertl
Date: Fri, 09 Oct 2026 05:32
Date: Fri, 09 Oct 2026 05:32
66 lines
3900 bytes
3900 bytes
marcel hendrix <mhx@iae.nl> writes:
>For iForth on AMD Ryzen 7 5800X 8-Core Processor
>\ V* : 2,523,563,242 clock ticks
>\ naive-V* : 2,532,810,048 clock ticks
>\ pairwise-V* : 3,251,776,774 clock ticks
Note that V* is just a call to NAIVE-V* on systems that do not have a
builtin V*.
>Using recursion to effect compilation inside an interpreted definition
>( gen-v* ) is a no-no for iForth because it perceives it as nested
>compilation (which is not supported yet).
It does not nest definitions, so it's unclear why it should be
perceived as nested definitions.
Are you sure it is that problem? The same technique is used in
GEN-SUM in
https://www.complang.tuwien.ac.at/forth/programs/pairwise-sum.4th
and that works on iForth (at least on the 5.1-mini version I have).
For pairwise-fdot.4th iForth gave me some error that I did not
investigate further; looking at it again, both
iforth 'create testthis include /home/anton/gforth/compat/xlocals.fs include /home/anton/forth/pairwise-fdot.4th test bye'
and
iforth "create benchthis include /home/anton/gforth/compat/xlocals.fs include /home/anton/forth/pairwise-fdot.4th ' pairwise-v* bench bye"
work, so maybe the change that I made in the meantime (some words
generated by GEN-V* used to be normal colon definitions and are now
macros) makes the difference.
>It is interesting that it
>works in so many other Forths.
It does not surprise me at all. I see no reason why this should not
work. Or, in other words, if it does not work on iForth, it is
probably something that should be fixed in iForth.
Here are the results with iForth, which works with the current
version, on Zen4 (Ryzen 8700G):
gf-f gf-f-v3 iForth lxf sf64 vfx64
k cycles:u
1_543_608 2_043_449 v*
6_090_505 6_544_524 3_399_183 3_219_799 4_705_232 3_425_833 naive-v*
4_355_047 4_360_980 3_850_466 4_368_398 11_998_171 1_208_370 pairwise-v*
k instructions:u
3_618_216 3_117_902 v*
11_618_416 11_618_103 6_272_607 9_510_019 16_011_448 6_072_706 naive-v*
10_164_546 10_164_233 9_943_466 8_266_940 15_963_399 3_821_771 pairwise-v*
Looking at iForth's code for VG*2, I see quite a bit of pushing and
popping going on, so apparently something prevents the register
allocator from working as well as it does on some other code.
- 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.073240@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>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 05:32:40 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 66 Message-ID: <2026Oct9.073240@mips.complang.tuwien.ac.at> References: <2026Oct8.175513@mips.complang.tuwien.ac.at> <11a9aah$19g75$1@dont-email.me> Injection-Date: Fri, 09 Oct 2026 06:32:18 +0000 (UTC) Injection-Info: dont-email.me; logging-data="572498"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Ugwg1kHg5fM3tsWV/c8I5"; posting-host="e8d347a9092f3e963a34721c3f889ca2" Cancel-Lock: sha1:XDS2i+4H/zoGIJvq8/L4WG84iTg= sha256:fK1ndxQCxbeXDp9Q8LNcwsHYyHOzrbxO8YMqlE1avVM= sha1:+bvzovEHIlEGObi5JSzFDd2aZ9g= sha256:s6zvh26myI/cf7kWV621iPl91cneAji1mfD6X6mISLY= X-newsreader: xrn 10.11