Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.lang.forth Subject: Re: Actually... why =?UTF-8?B?bm90Pw==?= Date: Thu, 12 Jun 2025 10:08:02 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 66 Message-ID: <2025Jun12.120802@mips.complang.tuwien.ac.at> References: <1065e5a26154e76b8b30291ee600dde0@www.novabbs.com> <2025Jun11.231606@mips.complang.tuwien.ac.at> Injection-Date: Thu, 12 Jun 2025 12:41:53 +0200 (CEST) Injection-Info: dont-email.me; posting-host="75cd3259efc583fd19838e4225c49efd"; logging-data="2777713"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VpH25uclYqhi2pspjrePu" Cancel-Lock: sha1:5Vr0FiF3R8kZkjey5H3S9k9FvPY= X-newsreader: xrn 10.11 zbigniew2011@gmail.com (LIT) writes: >> It requires more work in COMPILE, than just doing a ",". But having a >> user-extensible intelligent COMPILE, (like Gforth) offers a number of >> advantages, especially for native-code compilers. .... >It's actually unbelievable! All it takes is rather >minor modification in INTERPRET. It only requires a change to COMPILE,. No change in INTERPRET. >So throughout >all these years since 70s FORTH could execute >the programs significantly faster - but they >were all the time selling/giving away the listings >that DIDN'T feature such advantageous change? In the 1970s and early 1980s the bigger problem was code size rather than code performance. And if you compile a variable or constant into the CFA of the variable, this costs one cell, whereas compiling it into LIT followed by the address or value costs two cells. You can try this out in Gforth, which includes a traditional-style ITC engine (that compiles with "," in nearly all cases) and an engine that uses an intelligent COMPILE,. When you do variable v 5 constant c : foo v c ; simple-see foo the output is: gforth $7F728BAA0DF8 lit 0->0 $7F23366A0E10 v $7F728BAA0E00 v $7F23366A0E18 c $7F728BAA0E08 lit 0->0 $7F23366A0E20 ;s $7F728BAA0E10 #5 $7F728BAA0E18 ;s 0->0 As for performance, here is what I measure on gforth-itc: sieve bubble matrix fib fft compile, 0.173 0.187 0.142 0.253 0.085 , 0.164 0.191 0.134 0.242 0.088 opt-compile, There is quite a bit of variation between the runs on the Zen4 machine where I measured this. Invocation with gforth-itc onebench.fs # for compiling with , gforth-itc -e "' opt-compile, is compile," onebench.fs >And even today the compiler creators don't apply >it, for no particular reason? Which compiler creators do you have in mind? Those that compile for MS-DOS? With 64KB segments, they may prefer to be stingy with the code size. - 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 2023 proceedings: http://www.euroforth.org/ef23/papers/ EuroForth 2024 proceedings: http://www.euroforth.org/ef24/papers/