GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-85160: Optimized singledispatchmethod access (noticeable improvement). by mental32 · Pull Request #23213 · python/cpython Conversation
|
|
Thanks for taking this up! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Comment to avoid closure |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@rhettinger sorry for bothering you but do you have enough bandwidth to review this or can you defer to someone else? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Not sure if there is anything we should do to allow this to be reviewed |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
On my slow system more modest, but an improvement:
11.24
2.27
to
5.83
3.54
I not that this is built on 3.10.0a2+ so there maybe further speed improvements when 3.11/3.12 is released. So a worthwhile change.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Since this is something that’ll have observable effects on objects, should this be documented? If you’re introspecting your objects, or are say concerned about memory usage it might be surprising behaviour. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mental32 @AlexWaygood By accident I created an independent implementation of the singledispatchmethod improvement. In #106448 I added a performance comparison of this PR and the other one. I also added a test for the case of a class with slots (commit 4e068d4). Feel free to pull that one into this branch. Both branches give a performance improvement over current main. Hopefully one of them gets accepted. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if self.attrname is not None: | ||
| attrname = self.attrname | ||
|
|
||
| try: | ||
| obj.__dict__[attrname] = _method | ||
| except AttributeError: | ||
| pass # not all objects have __dict__ (e.g. class defines slots) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| if self.attrname is not None: | |
| attrname = self.attrname | |
| try: | |
| obj.__dict__[attrname] = _method | |
| except AttributeError: | |
| pass # not all objects have __dict__ (e.g. class defines slots) | |
| if self.attrname is not None: | |
| try: | |
| obj.__dict__[self.attrname] = _method | |
| except AttributeError: | |
| pass # not all objects have __dict__ (e.g. class defines slots) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@eendebakpt thank you for continuing with this! for any changes or merging that you would like to see done is it okay for me to say "do whatever you need to do :)" and defer to you? (including closing this PR if the other one is sufficient in perf improvements) I don't think I have the time to pay attention to this is all |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing in favour of #107148 (in which you have been listed as a co-author :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.