Path: csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!] Date: Wed, 18 Sep 2024 13:10:31 -0700 Organization: A noiseless patient Spider Lines: 40 Message-ID: <87zfo4zps8.fsf@nightsong.com> References: <66d26c4b$1@news.ausics.net> <87bk0vbvgk.fsf@nightsong.com> <66e0fa58$1@news.ausics.net> <66e11d64$1@news.ausics.net> <877cbh4b6z.fsf@nightsong.com> <2024Sep12.105526@mips.complang.tuwien.ac.at> <87seu01zbj.fsf@nightsong.com> <2024Sep16.182651@mips.complang.tuwien.ac.at> <66ea4436$1@news.ausics.net> <874j6d1pw8.fsf@nightsong.com> <66ea8196$1@news.ausics.net> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 18 Sep 2024 22:10:32 +0200 (CEST) Injection-Info: dont-email.me; posting-host="abbb1fb21ca93238a096b66ff76f516e"; logging-data="213625"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/gafAMLm5+FbZyqSnmpSOK" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cancel-Lock: sha1:OKlRnqCL5mhCl2OdDzCIrC/YbuM= sha1:JRygCkd++zWrfus7suD+nKxDO8I= Xref: csiph.com comp.lang.forth:132252 dxf writes: > I think we're retreading old ground. Orders of 30% reduction in code > size were in respect of optimizing compilers (VFX). That 30% difference was because VFX doesn't attempt to optimize locals. If two pieces of code are obviously equivalent (the locals and no-locals version of EMITS) then a fancier optimizing compiler is likely to generate the same code for both. What I was getting at though is that VFX even using locals will still beat the pants off any interpreter, even without locals. So if you have interpreted Forth code using locals and want it to be faster, you get far more gain compiling it with VFX than you would get by undoing the locals. If you're already using VFX then yes, you can squeeze out a bit more performance by not using locals, but that just tells me that the VFX optimizer is still a work in progress (which is fine). > I can assure you I don't find using stack operators a burden. Indeed > I find them reassuring as it puts me in control. It's hard for me to understand that. If you're using VFX, the stack operations are transformed by compiler gyrations to register ops so SWAP, ROT, etc. generate no code at all, but this is completely out of sight and you have no control over it. Locals on the other hand (in an interpreter) are equivalent to RPICK at specific offsets in obvious ways, so there is no loss of control. That also happens with locals in VFX but it's only because VFX (for now) hasn't pursued optimizing them. That example using FVALUE just seems to be a loss: the storage cells are constantly tied up even when not active. If that function can be used in a multitasking environment, you might even need a separate copy for each task. Significant efficiency loss. > Forth is a niche language. If there's success to be had, it will be > on its own merits and not ideas imported from other languages. That seems to support looking at any particular feature on its merits. Adding to that a dislike of standardization, it would seem to be up to the programmer, with most choices being legitmate for any particular programmer.