-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Objectloop optimization #311
Comments
It's difficult to pattern-match for the general case. E.g. Advent.inf has a line which is even messier:
Also note that using the sibling chain isn't really a safe optimization. E.g. currently this works:
But if it used the object tree, this would break. Cases like this aren't documented as safe, but it's an area where people probably relied what the compiler did rather than what the manual said. |
It's unfortunate that the order of the iteration changes, depending on method used.
Produces this result
There's no easy fix to this, because games can depend on this behaviour. |
I agree that it doesn't make sense to change this behaviour now, as many old games would have weird effects if recompiled. I thought I had seen in DM4 that |
Note: I only examined this for Z-code.
Objectloop generally loops over all objects in the game. Any checks that are made in the objectloop are made to all objects.
However, if the source code follows this pattern, it changes this to start with child(y) and move to the next with sibling(y);
Unfortunately, this faster way of iterating over the contents of an object is not used when the code looks like this:
(or, as far as I can tell, any other condition is added)
Is this something that could and should be changed?
Iterating using sibling is faster and visits the objects in a different order than looping over all objects.
The text was updated successfully, but these errors were encountered: