Is Code Efficiency Still an Issue?

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?


It can still matter, but generally not for the average game. It’s more of an issue for huge games like Counterfeit Monkey.


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 :slight_smile: … 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.)



I think last time this came up I thought lots of rules would matter more than it did, and someone else had the data to show it doesn’t :wink:

1 Like