| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
The improvements keep on coming!
Sorry, something went wrong.
| objtype = type(obj) | ||
| if type not in _static_getmro(objtype): | ||
| klass = objtype |
There was a problem hiding this comment.
This has equivalent semantics with less code and fewer assignments, but perhaps it muddies the semantics of the klass var a bit (since it will temporarily be "wrong" in the case that obj is already a type.) No strong feelings, whatever you prefer.
| objtype = type(obj) | |
| if type not in _static_getmro(objtype): | |
| klass = objtype | |
| klass = type(obj) | |
| if type not in _static_getmro(klass): |
Sorry, something went wrong.
There was a problem hiding this comment.
Hmm. Yeah, I see what you mean, but I think I'd prefer to keep the semantics of klass clear here :)
Sorry, something went wrong.
Optimisations will continue until morale improves! |
Sorry, something went wrong.
Improve performance of `inspect.getattr_static`
| Back | FazBrowse Home | New Git URL |
(Using @sobolevn's benchmark script from #103193 (comment).)
Benchmarks on main:
Benchmarks with this PR:
This speeds up this isinstance() call 1.25x relative to main: