3 ms·
And ran a lot faster than BASIC.
by crest 5y ago
And 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.