Graham, on 14 October 2016 - 02:47 PM, said:
One more clarification: do any blank lines anywhere in the robotic code get read every time the code is executed, or would only those lines that are in a section of the code that is currently being executed be read? In other words, does the entire program get scanned when a robot is running, or just the lines that are between cycle ending commands (e.g. label and goto command)?
Reason I ask is I've been leaving a lot of lines empty after goto commands, I've felt it has helped me sort things out better and I didn't think it had any effect, being after a goto. If all of these blank lines are being read, I might need to think about whether I want to remove them. The game runs well, but it might affect slower computers, maybe?
Only code that is run can slow things down.
It's been a long time since I've looked at MZX's source but I think labels are stored in a jump table, so that won't matter. The only thing to perhaps be concerned about is "loop for #", which scans up for "loop start". That's only relevant if you're doing something absurd like:
loop start
goto "a"
. "five thousand blank lines"
: "a"
loop 10000
Seriously though, blank lines don't really matter and you don't really need to worry about them. The amount of execution time they take up is almost immeasurably low. There's probably a billion things you can optimise that will give you better results than removing your blank lines.
Honestly, the main reason I shy away from comments is because they consume a lot of robot memory and running out of robot memory is super annoying - in many cases a robot can be extremely hard to split, especially if it is subroutine-heavy.