1> Does setting array and string indexes to start at 1 - to make it like basic - make for less efficient code?
(that is using the new default for --sinclair that Boriel is presumably putting into the next version)
2> Boriel once mentioned that the default behavior for code like:
ld a, 10 ;Init
ld (_A), a ;Load
inc a ;Inc
ld (_A), a ; Store <<<<< Not needed
sla a ; Multiply
ld (_A), a ; Store
And that -O3 should remove that extra code. I actually can't tell the difference in the above with or without -O3.
What does -O3 do? My code seems to be remarkably similar. In fact, the runtime routines for almost everything are included still - most of the print system (AT, COLOR, BOLD, ITALIC) even if never used).
Is -O3 doing what it's supposed to? I find most short code seems to be just about the same size, suggesting it isn't cutting down on runtime routines at all.
Actual program used:
DIM A as byte
Actual -O3 Result:
E:\ZX\ZXBwork>zxb Test2.bas -A -O3
INFO: __PRINTI8 is not defined. No optimization is done.
INFO: PRINT_EOL is not defined. No optimization is done.
The produced code was 1134 bytes without -O3 and 1132 bytes with -O3.
The difference is the end of the program. Optimized it does
ld bc, 0
Unoptimized it closes out with
ld hl, 0
ld b, h
ld c, l
That's the only difference.
These error messages seem a little odd. Am I misusing the -O3 option, somehow? I was expecting it to cut out all the runtimes that wouldn't be needed.
Admittedly in a larger project, most of the runtimes would likely end up being used. I was a little spoiled by the tiny code that the hisoft compiler made, I think