Open rjlopez2 opened 1 year ago
I think I can explain the hit to performance. Every time the slice changes a new draw event is triggered, as the plugin draws the current z slice. The current implementation of the draw function is relatively performance heavy as the whole canvas is cleared and redrawn. Matplotlib is not perfect for such an application.
I already have an improved version of the drawing machinery but it will still be somewhat resource heavy when combining it with the playback function. In the current version the data acquisition and the drawing is one function, in the new version they are separate. This might help.
I might have some time this week and will run some tests with the new functions.
Thanks for reporting. :) Anything else you noticed?
thanks for the fast reply!
Every time the slice changes a new draw event is triggered, as the plugin draws the current z slice. The current implementation of the draw function is relatively performance heavy as the whole canvas is cleared and redrawn. Matplotlib is not perfect for such an application.
on this, I don't know if this tips mentioned here by Juan-Nunez might be of interest.
I was also thinking on using/implemented some other recommendations from the Napari documentation such as multithreading those task that are computational consuming and are independent of the main thread e.g average a ROI. Do you think that that make sense?
Anyway, from now that's all. I look forward to see your results and check out the version you are working on.
Cheers
Ruben
@rjlopez2 I can reproduce your observations. The fps drop if the plugin is docked, it is not necessary to select a layer and actually plot. I think I have to review which event triggers the plotting. Seems like it causes redraws in situations when it shouldn't. Big thanks for reporting this.
Thanks for the pointer to Juan-Nunez's post, that's exactly the thing I try in the new implementation.
It's somewhat tricky to keep track with as small an overhead as possible, but I think it will work. At the moment the changes are only in my local repository, will probably push them the moment the first draft works properly.
Hi @rjlopez2 , I fixed in my rework of the plugin, the playback performance is no longer affected at all. I will close this issue as soon as the changes go live.
Thanks @Chris-N-K! I look forward to check this out and thanks for your work. Cheers
Hi Chris,
I have seen a slightly decrease in performance for rendering some relatively modest size timestacks in napari when using your pluging. I have been thinking for some time now how to address this problem but may be you could give me a better insight on this and may be take me to the right track on how to fix this.
Here is a way to reproduce the issue:
Load your plugin
See the increased latency in the playback of the current image
close your plugin
playback speed comes back to normal
Do you have an idea what could be the reason of this drops in performance when I load your plugin?
best
Ruben