ivoflipse / Pawlabeling

Tool for processing and analyzing pressure measurements
Other
18 stars 1 forks source link

Reduce the number of calls with pubsub #42

Closed ivoflipse closed 10 years ago

ivoflipse commented 11 years ago

While I think pubsub is great, resolving which function to call seems to be a rather big bottleneck (there's no such thing as a free lunch eh?). So especially in the processing widget, when you're labeling contacts, you want that to have a very low overhead, because any delays makes it annoying to use.

ivoflipse commented 11 years ago

Another thing that might be making this slow (while having nothing to do with pubsub), is that I recalculate the average every time, which gets more difficult as you add more and more contacts. Looking at the profile results, processing_widget.update_current_paw takes .650 seconds per call.

I believe this calls model.calculate_average, which takes 0.33 seconds per call. Furthermore, the paws_widget gets updated 55 times (5 paws_widgets * 11 contacts), even though clearly there are only 11 paws. It shouldn't have to update if nothing changes. So figure out how to optimize both the updating and the drawing, so its less wasteful.

ivoflipse commented 10 years ago

Issue #63 follows up on this issue, by making sure no work gets done if a widget is inactive. This issue should be mostly resolved, because the pubsub calls to the results widgets are intercepted by the parent of the 4 widgets that draw the results and only propagates the event if the widgets are active.