Skip to content

Conversation

@dysonreturns
Copy link

This commit is an optimization.
I ran cProfiler on an example bot of sorts and noticed that unit.tag is one of the worst offenders.
I made it a cached property instead and it cleared itself up.

This is due to heavy dictionary lookups in practice.
Rasper has been manually caching tag in his framework for some time, using custom overrides and agrees this change is safe.
So, nowhere in the library or in the wild do we manually change a unit's identifier once set.

I firmly believe this can go upstream.

Before:
before

After:
after

@BurnySc2 BurnySc2 merged commit a1795cf into BurnySc2:develop Jun 27, 2025
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants