05-27-2010, 07:53 PM
Ok: I downloaded Hisoft Basic 1.1 from World of Spectrum, and compile and run your Test BM7. It prints 4.8 segs.
I recompiled it with ZX BASIC (just declaring variables as Uintegers, which is the +INT equivalent), and execute it. It prints 2 segs.
This is 100% faster (or x2 speed).
Conclusion: Running *THE SAME* program, ZX Basic compiles better than Hisoft 1.1
Observations:
I recompiled it with ZX BASIC (just declaring variables as Uintegers, which is the +INT equivalent), and execute it. It prints 2 segs.
This is 100% faster (or x2 speed).
Conclusion: Running *THE SAME* program, ZX Basic compiles better than Hisoft 1.1
Observations:
- -O3 effectively removes unused vars, since variables you don't use for IO (PRINT, POKE, PEEK, BEEP, IN, OUT, Function calls) are not used. Just a dummy print at the end (a future compiler #pragma will prevent this) avoid this.
- If a newer version of Hisoft Basic (or another compiler) speeds up to 0.2segs or alike, it could be also removing unused vars.
- HiSoft is a VERY GOOD compiler. It is slower because it's also checking for CTRL+Break (you can stop running programs). ZX Basic will also have this feature in the 1.2.6 final with --enable-break
- Don't know if Hisoft is doing Constant optimization (eg. K/2*3+4+5 => K/2*3+9)