John Wilson <wilson(a)dbit.dbit.com> wrote:
I've never understood this. Evidently most/all of the FIG FORTHs produced
threaded code, but I haven't found a single peep about it in the FIST
standards
that say it's an inherent part of the language. I've written FORTHs that did
it both ways, very simple-minded in each case but I think it would be pretty
easy to write a FORTH that at least pruned out most of the superfluous stack
use (stuff that gets pushed and then popped right off) and could produce
semi-decent machine code.
Hi
I think that most of the FIG Forths were done that way to keep
the implementation across various platforms consistant. It surely
wasn't the fastest.
I've done a call threaded Forth on Analog Devices' ADSP2100.
On a 2181 running at 33MHz it can sort 1000 integers in
6.8 milliseconds and that is code written in high level
Forth. I did a lot of peep-hole optimizing to keep the
top elements of the stack in registers when I could.
It also overlaped many words when compiled. Still, it wasn't
the fastest compiler. Analog Devices 'C' compiler took the
same basic source code and ran the sort a about 4 millisec.
Of course, the Forth code fit into less then 200 words of
code while the 'C' code took over 1K words. They spent a
lot more time and money on their optimizer than I did.
If anyone out there doesn't think sorting 1000 signed integers
in 6.8 millisecs isn't fast, code it up on your PC and
see how fast it is.
Dwight