Reduce `goto` in favor of `call/return`
huderlem opened this issue · 2 comments
huderlem commented
Currently, poryscript emits goto
statements to manage all of its branching. It never uses call
. The resulting script is bigger than it ought to be because of logical returns that are implemented as goto
. return
only takes up a single byte, while goto
takes 5.
There are opportunities to use call/return
, but should be careful about the call stack. Gen 3's scripting engine has a call stack limit of 20.
huderlem commented
I guess it's just if
statements with no attached elif
or else
blocks that can benefit from this type of change.
huderlem commented
This opens a whole can of worms, and barely saves anything in the long run, since it only applies to a narrow situation.