Core: Better scaling explicit indirect conditions (#4582)

* Core: Better scaling explicit indirect conditions

When the number of connections to retry was large and `queue` was large
`new_entrance not in queue` would get slow.

For the average supported world, the difference this change makes is
negligible.

For a game like Blasphemous, with a lot of explicit indirect conditions,
generation of 10 template Blasphemous yamls with
`--skip_output --seed 1` and progression balancing disabled went from
19.0s to 17.9s (5.9% reduction in generation duration).

* Create a new variable for the new set created from the intersection
This commit is contained in:
Mysteryem
2026-02-21 14:16:57 +00:00
committed by GitHub
parent 48c201af19
commit 0de09cd794

View File

@@ -788,9 +788,11 @@ class CollectionState():
self.multiworld.worlds[player].reached_region(self, new_region) self.multiworld.worlds[player].reached_region(self, new_region)
# Retry connections if the new region can unblock them # Retry connections if the new region can unblock them
for new_entrance in self.multiworld.indirect_connections.get(new_region, set()): entrances = self.multiworld.indirect_connections.get(new_region)
if new_entrance in blocked_connections and new_entrance not in queue: if entrances is not None:
queue.append(new_entrance) relevant_entrances = entrances.intersection(blocked_connections)
relevant_entrances.difference_update(queue)
queue.extend(relevant_entrances)
def _update_reachable_regions_auto_indirect_conditions(self, player: int, queue: deque[Entrance]): def _update_reachable_regions_auto_indirect_conditions(self, player: int, queue: deque[Entrance]):
reachable_regions = self.reachable_regions[player] reachable_regions = self.reachable_regions[player]