I mean: when a variable if found,
instead of its CFA - 'LIT PFA' should
be compiled directly. When a constant
is found — 'LIT <value>' should be compiled,
instead of constant's CFA.
Do I miss anything, any eventual problem?
...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.
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?
And even today the compiler creators don't apply
it, for no particular reason?
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.
Please, have a mercy... :D it's A SINGLE cell you're
talking about.
Even, if (let's assume) the two bytes
may(?) have some meaning during 70s, still in the 80s -
in the era, when 16 KB of RAM, and soon later 64 KB
became de facto standard - it wasn't sane decision(?)
to cripple the compiler(s) by "saving" (literally)
a few bytes.
64 KB is a whole lot compared to "savings"
of (literally) two-byte size per VARIABLE/CONSTANT
definition. Say we've got 200 of them together
in the program — so 400 bytes has been "saved"
at a cost of significantly degraded performance.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 504 |
Nodes: | 16 (2 / 14) |
Uptime: | 237:33:43 |
Calls: | 9,887 |
Calls today: | 9 |
Files: | 13,794 |
Messages: | 6,207,246 |
Posted today: | 3 |