Reading __dict__ once permanently deoptimizes attribute access
Since 3.11 attribute access has not been a dict lookup, and reading __dict__ once takes the specialized path away for good
Start with the oldest performance tip in Python. Pull the attribute out of the loop:
[Read More]