Closed drakonnan1st closed 5 years ago
Already submitted a version that will reduce the loop to once per frame:
https://github.com/Dentosal/python-sc2/pull/202/files#diff-6db6c51856eb1f881634e4fa09e9fe79R395
I think this is solved then, feel free to reopen if there is something else.
Current version of already_pending:
Regardless of what we're trying to find, the function will always loop over
self.units
,self.workers
, andself.units(UnitTypeId.EGG)
, even when not needed. This slows down the function, which is more noticeable when it is called many times. Maybe it would be better to split it based on the requested unit type (e.g. already_pending_eggs, already_pending_units, already_pending_buildings)