Sujet : Re: OOS approach revisited
De : minforth (at) *nospam* gmx.net (minforth)
Groupes : comp.lang.forthDate : 27. Jun 2025, 21:35:32
Autres entêtes
Message-ID : <mc8dkkFeh4uU1@mid.individual.net>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
Am 27.06.2025 um 20:15 schrieb
albert@spenarnc.xs4all.nl:
In article <bc63996456fe967e5c66d17cbbeb21c2@www.novabbs.com>,
LIT <zbigniew2011@gmail.com> wrote:
It really depends on how counted loops are implemented.
Most CPUs have operators for register-based count-down loops
that are blazingly fast.
>
If they can be used within Forth-based loop constructs
I would expect a greater speed increase than what you measured.
>
In that old fig-Forth it's rather short and simple:
>
sqHeader '(LOOP)'
XLOOP dw $ + 2
mov BX,1
XLOO1: add [BP],BX
mov AX,[BP]
sub AX,[BP+2]
xor AX,BX
js BRAN1
add BP,4
inc SI
inc SI
jmp NEXT
>
It doesn't look that bad. Can it be
done even shorter?
My optimiser looks into the combination of DO and LOOP,
transfers the returns stack into registers after inlining
everything. It is near vfx performance.
All experimental, but yes there is much to be gained.
Must be tricky to do UNLOOP in a register-based loop. ;-)