3 ms·
The main selling point of Forth in the 80s is that it was more productive than assembly.
by veltas 5y ago
The main selling point of Forth in the 80s is that it was more productive than assembly.
- crest 5y agoAnd ran a lot faster than BASIC.
- veltas 5y agoDepends on the BASIC, and the Forth!
- timbit42 5y agoForth is always faster than interpreted BASIC. The speed of compiled BASIC depends on the compiler. Some compilers did very little and didn't increase the speed much because they tried to remain compatible with the ROM BASIC in the system. Compiled BASICs which went their own way were as fast as Forth, occasionally faster.
- veltas 5y agoI think of an example like the ZX Spectrum which is pseudo-compiled. Stuff like addresses for goto line references and variable addresses were pre-baked (I think?), it was stored tokenised, and the maths library was stack-based like Forth. Under the hood they don't even have to be that different, tokenised Forths are a thing. And Forths and BASICs can be fast or slow, really depends how much time is spent optimising.
- timbit42 5y agoI've benchmarked every 8-bit language I could get my hands on. Interpreted BASIC is typically 1/50th the speed of assembly. Forths are typically 1/5th to 1/10th the speed of assembly, depending on the function, which means Forth is 5 to 10 times faster than BASIC, depending on the function. Python is also about 1/50th the speed of C.
- verytrivial 5y agoI've also heard it's proponents say that it also provides very high functionality density for for a given memory footprint. Statically compiled languages tend to inline and unroll a lot and optimization control can be very coarse or fiddly. Forth forces (forthes?) you to decide this because is it more like a structured assembly language + runtime. Certainly intriguing.