The event duplicate check can be quite slow when there are lots of notifiers, for example when adding a huge amount of objects from a script.
By reversing the loop duplicates will be found faster.
Profiling:
Differential D9901
WM notifier queue optimization Authored by Erik Abrahamsson (erik85) on Dec 18 2020, 10:36 PM.
Details
The event duplicate check can be quite slow when there are lots of notifiers, for example when adding a huge amount of objects from a script. Profiling:
Diff Detail
Event TimelineComment Actions This patch is on the bare side, i may work just fine, but the description is on the lacking side, beyond "look it's faster now, here's some out of context screenshots" is virtually gives us nothing to work with. Yes there's two screenshots, but for all i know they are from different work loads. I'd like to see at-least the following for performance related patches
running attached scripts:
For future patches it's good to keep the guidance in the ingredients for a patch in mind. Comment Actions The wm_event_do_notifiers part of that profile should be eliminated by rB4b46afae0951: WM: minor optimization for when there is a large number of notifiers. For the rest, I think it's possible to write a Python script that is significantly worse in either case. If you send notifiers AAABBBCCC then backward will be faster. If you send ABACADAE then backward will be slower. Fundamentally it's the time complexity that needs to be fixed, and frankly most of the notifier system should be eliminated. If backward helps in real world cases I could commit this as a stopgap, but not sure how much performance gain is left after my commit. Comment Actions @Brecht Van Lommel (brecht) |