Re: Actually... why not?

Liste des GroupesRevenir à cl forth 
Sujet : Re: Actually... why not?
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.lang.forth
Date : 12. Jun 2025, 11:08:02
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2025Jun12.120802@mips.complang.tuwien.ac.at>
References : 1 2 3
User-Agent : 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/

Date Sujet#  Auteur
11 Jun 25 * Actually... why not?13LIT
11 Jun 25 `* Re: Actually... why not?12Anton Ertl
12 Jun 25  `* Re: Actually... why not?11LIT
12 Jun 25   `* Re: Actually... why not?10Anton Ertl
12 Jun 25    +* Re: Actually... why not?4LIT
12 Jun 25    i+- Re: Actually... why not?1LIT
12 Jun 25    i`* Re: Actually... why not?2Anton Ertl
12 Jun 25    i `- Re: Actually... why not?1LIT
12 Jun 25    `* Performance benefits of primitive-centric code (was: Actually... )5Anton Ertl
13 Jun 25     `* Re: Performance benefits of primitive-centric code4minforth
13 Jun 25      +* Re: Performance benefits of primitive-centric code2Paul Rubin
13 Jun 25      i`- Re: Performance benefits of primitive-centric code1Anton Ertl
13 Jun 25      `- Re: Performance benefits of primitive-centric code1Anton Ertl

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal