In the 2015 edition of the Handbook I advised authors to prefer Check, Carry Out, and Report rules rather than rely on Before, Instead, and After, because the latter are less efficient at run-time. This could apparently become an issue when games were running in a handheld device or in a Web browser.
My guess is that I can probably scrap that whole discussion, as computing devices are a lot faster now. But am I guessing correctly, or is code efficiency still advisable?
Every exception rule has to be checked for applicability every turn, whereas Check, Carry Out, and Report only have to be checked for applicability when they’re, uh, applicable … based on the action and other clauses in the rules.
The thing is, if you generally program in sympathy with Inform’s ways, you can’t avoid using the exceptions anyway. If you need a Before rule, you need one. If you have a system that gives code work to Carry out and text work to Report, you’re probably going to need an After rule to deal with a significant exception in that system.
Last time I asked about this (and I have asked and talked lots of times) I think @Danii did or showed me some kind of test showing that using exception rules was making next to no difference, even when they were massively stacked up?
Things I know for sure, from personal demonstrable experience, that can more easily affect runtime performance if they’re happening every turn (adding lag – which is more the problem than one-off situations) are:
Using lots of regular expressions, or using them inefficiently when simpler one(s) would work
Leaning hard on complex relations you’ve set up. Checking those relations unnecessarily
Overtaxing scope / visibility checks
Looping through huge amounts of things every turn (e.g. the original Epistemology extension could slow down in big games. If you use Zarf’s revised I6 call version, that dongs that on the head.)