"Before doing something other than..." slowing compilation way down

I’m currently writing a game that, at the moment, makes heavy use of Before doing something other than ... when the current action involves ... rules to redirect all but a selection of actions from parts to their parent things. These rules slow compilation noticeably, so that for the last while it’s been taking several minutes, and then today it started making it to 38% and freezing entirely. This, for now, isn’t a massive problem—I can comment out the code and keep writing. But when I go to release it, I fear it will just keep stalling. Is there any more efficient construction that doesn’t put such a load on the compiler? Thanks!

There’s nothing obviously special about the I6 generated from a rule of that basic form. Can you provide any more details about the specific rule that seems to be causing the problem?

involves tests all of noun, second noun, actor so you can cut back a bit there.

How did you write what’s after involves? If it’s a relationship test, it wouldn’t surprise me if it’s doing (number of objects)^2 tests.

[ oops, you said compilation, not runtime, so I don’t know what’s going on… ]

Since Otis and Zed are stumped, I’m wondering whether the specific rules aren’t the issue and you’re just running into the Windows antivirus issue? Short version: the built-in antivirus in Windows (Defender/Security) can mess with the IDE and really slow down compilation times, but if you add it to the exclusion list it speeds right back up. Details are in the thread if that sounds like a possibility.

oh, yeah, there’s also a current known bug in the development-version Linux IDE (I’m not sure whether it’s also in the 10.1 release version) where a CPU (or core) gets pegged to 100%.

so what’s your environment and version of Inform, and are you using an IDE or compiling from the command-line?

1 Like

I’m using Inform for Mac version 1.82, compiling to 10.2. Since I’m working on a Mac, the antivirus bug is out.

The rules generally look like this:

Before doing something other than examining or climbing or crouching on or lying on or pulling or pushing or turning or sitting on or standing up on or taking when the current action involves the oven-door (this is the redirect from the oven-door to the oven rule):
	if the oven-door is the noun, now the noun is the oven;
	if the oven-door is the second noun, now the second noun is the oven;
	try the current action instead.

There are about 50 of them currently, and will likely be more like 70 all told. No one of them throws up an error, but commenting them out speeds up compilation significantly (and/or allows it to happen at all).

1 Like

Is it the same set of actions for all of them? Is exactly one level of incorporation all you’ll be dealing with, or might you have parts of parts? and do you always want to do the parent object with those actions for parts, or is it tuned on a per-object basis?

Could you try compiling with the 10.1 version just so we could see whether it might be a new bug in 10.2 ?

1 Like

It is not the same set for all of them. There may be a few parts of parts, but I don’t think more than one or two (I’ll have to go back through to be sure). Mostly it’s the parent object, but a few rules redirect to other parts, or have the parent itself redirect to a part. I’m having trouble getting 10.1 to begin to compile, but will report back once I succeed or fail.

Hmm. Seems there’s a good chance it’s the same issue as this:

I don’t see that I ever filed a bug for this. I will tonight.

1 Like

do you only need one such “if the current action name is not among (these action names) when the noun is X or the second noun is X:” rule for any given thing, X?

1 Like

I currently have one or two where there’s more than one, but if there’s a way that makes it work that only allows one per thing I can work with that.

Lab is a room.
The oven is in the Lab. It is fixed in place. The description of the oven is "oven".
The oven door is part of the oven. The description of the oven door is "door!".

a dummy-thing is a thing.

a thing has a list of action names called the dispatch-me-not.
a thing has a thing called the dispatch-proxy.
the dispatch-proxy of a thing is usually the dummy-thing.

This is the dispatch rule:
  if the noun is something and the dispatch-proxy of the noun is not the dummy-thing and the action name part of the current action is not listed in the dispatch-me-not of the noun begin;
    now the noun is the dispatch-proxy of the noun;
    instead try the current action;
  end if;

last before: say "The noun is [noun].";

To dispatch everything but (l - a list of action names) for/from/of (item - thing) to (proxy - thing):
  now the dispatch-me-not of item is l;
  now the dispatch-proxy of item is the proxy;

after starting the virtual machine:
  dispatch everything but { examining action, climbing action, pulling action, pushing action, turning action, taking action } for the oven door to the oven;
the dispatch rule is listed before the before stage rule in the action-processing rules.

Test me with "x oven door / get oven door / touch oven door / eat oven door".
1 Like

You are a lifesaver and a genius. Thank you so much.

1 Like

Bug reported: I7-2463.

1 Like

For those using this example in the future: I’d recommend also using this rule during debugging, especially if you have any custom commands or grammar in your game:

This is the just checking in rule:
	say "The noun is [noun].";
	say "[action name part of the current action].";
	if the noun is a thing, say "[dispatch-me-not of the noun]";

the just checking in rule is listed before the dispatch rule in the action-processing rules.

This will be sure that the action it’s catching is the action you intend, before the replacement goes into effect.

1 Like