Performance of attribute lookup for module objects #104066
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
performance
Performance or resource usage
type-feature
A feature request or enhancement
Feature or enhancement
Similar to gh-92216 (for type objects) - attribute lookup on module objects for non-existing attributes is significantly slower compared to existing attributes, as well as non-existing attributes on types and instances.
microbenchmark on main:
As in gh-92216, the reason for the slowness is time spent in creating an
AttributeError
, which is not needed.By adding a special case for modules (similar to the type special case in gh-99979), this overhead can be eliminated.
Linked PRs
The text was updated successfully, but these errors were encountered: