Bug 1205 - Many redraws in some cases where one redraw should be sufficient
Summary: Many redraws in some cases where one redraw should be sufficient
Status: RESOLVED WORKSFORME
Alias: None
Product: PulseView
Classification: Unclassified
Component: Performance (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: PulseView 0.5.0
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-19 21:03 CEST by Uwe Hermann
Modified: 2018-06-17 16:04 CEST (History)
1 user (show)



Attachments
Repain debug patch. (1.09 KB, patch)
2018-06-16 17:31 CEST, Uwe Hermann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Uwe Hermann 2018-05-19 21:03:50 CEST
There seem to be a few cases where multiple redraws are triggered in situations where this is surprising. This was tested by adding a qDebug() in paint_mid().

 - Apparently 16 redraws for every click into "white space" (not in a trace).

 - Apparently ca. 8 redraws when traces are dragged a tiny amount (smallest one I could manage to do with my mouse).

 - Apparently 8 redraws if you click in the ruler area once.

For all of the above I would expect one single redraw should be sufficient, so 8 or 16 is a bit surprising and probably has performance implications.

There might be a few additional cases where multiple redraws could happen, we should probably systematically analyze all of this.
Comment 1 Soeren Apel 2018-06-15 07:55:58 CEST
Where exactly did you add the paint_mid()? If you added it to LogicSignal then 16 would be perfectly acceptable if you have 8 channels enabled since every channel is drawn separately.
Comment 2 Soeren Apel 2018-06-15 07:56:18 CEST
...the qDebug(), I mean.
Comment 3 Uwe Hermann 2018-06-16 17:31:05 CEST
Created attachment 437 [details]
Repain debug patch.
Comment 4 Uwe Hermann 2018-06-16 17:32:33 CEST
I attached my test patch. It's possible that I misinterpreted the output, you're probably in a better position to double-check if all output looks correct for all situations (on logic channels, only analog, logic+analog, clicking in white space, clicking / moving the mouse to certain areas like ruler etc. etc.).
Comment 5 Soeren Apel 2018-06-17 10:12:30 CEST
Yeah, it's like I assumed: as each trace/signal is painted independently, one paint action of the view results in 8 LogicSignal paints if you have 8 channels enabled. This is why you see multiples of 8 in your output.

If you want to catch the "main" paint event, check out ViewPort::paintEvent(). If you see multiple paints there, we should investigate. Otherwise I'd say this bug can be closed.
Comment 6 Uwe Hermann 2018-06-17 16:04:45 CEST
Yep, I've played around with this some more and I'd say the issue can be closed.

The only somewhat surprising thing that remains, is that a single click (no drag, no zoom, etc.) in the "white" area (where there are no traces) triggers redraws at all, since nothing on the screen has to change due to that click (currently).

The same goes for simply moving the mouse in the white area (triggers Viewport::paintEvent() calls from what I can see), whether or not there are channels enabled at all.

It's not a big deal performance-wise though, and technically some features could require these redraws (now or later), e.g. highlighting stuff depending on mouse position etc.