refactor: split out SlotCaller logic into new weak_callable module... maybe public eventually#178
Merged
tlambert03 merged 23 commits intopyapp-kit:mainfrom Feb 20, 2023
Merged
Conversation
CodSpeed Performance ReportMerging #178 Summary
Benchmarks breakdown
|
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #178 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 16 +1
Lines 1451 1495 +44
=========================================
+ Hits 1451 1495 +44
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Closed
weak_callable module... maybe public eventually
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves all of the "_SlotCaller" class logic into a new "_weak_callback" module, and restructures it quite a bit. The idea is that it could potentially be made public. (A good part of the effort that goes into psygnal is in ensuring that all of the connected callbacks are both as weakly referenced as possible, in many edge cases, while also being as fast as possible to deference in call at emit-time ... and that logic lives independently enough)
the
psygnal._weak_callback.weak_callbackfunction is the primary factory_function now, and thecbmethod is how it should be called.This PR significantly increases the time for the
connect_setattrandconnect_setitem, but those are relatively rarely used functions, that only get called once. In turn, this PR slightly improves the emission time for most callback types (which is the much more performance critical part) and I think makes for a much cleaner code pattern