pyapp-kit / psygnal

Python observer pattern (callback/event system). Modeled after Qt Signals & Slots (but independent of Qt)
https://psygnal.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
84 stars 13 forks source link

perf: Do not use reducer if there is no callback in `SignalInstance.resume` #278

Closed Czaki closed 8 months ago

Czaki commented 8 months ago

This is followup to #277

Remove the whole reducing operation if there is no callback.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (ab5dfc5) 100.00% compared to head (9ec3f99) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #278 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 23 23 Lines 1926 1929 +3 ========================================= + Hits 1926 1929 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codspeed-hq[bot] commented 8 months ago

CodSpeed Performance Report

Merging #278 will not alter performance

Comparing Czaki:remove_reducer_call_on_no_slot (9ec3f99) with main (ab5dfc5)

Summary

✅ 66 untouched benchmarks

Czaki commented 8 months ago

Should I add test for it? (some mocking of reducer)

tlambert03 commented 8 months ago

works for me!

tlambert03 commented 8 months ago

Should I add test for it? (some mocking of reducer)

normally i'd say don't bother, but since we've got 100% coverage here, might as well keep it :)

tlambert03 commented 8 months ago

actually... it's fine. the logic is so simple, and it does get covered by tests already. will merge. thanks!