[Interest] Optimizing performance with hundreds of widgets

Elvis Stansvik elvstone at gmail.com
Tue Feb 21 13:27:04 CET 2017


2017-02-15 18:28 GMT+01:00 Gibbs, Matt <mgibbs at slac.stanford.edu>:
> Hi All,
>
> I’m working on a Qt-based project to display rapidly updating information from a control system.  I want to display hundreds of signals, each updating at about 10 Hz.  As a performance test, I’ve thrown 500 Labels in a grid layout, and fire a timer every 100 ms which calls setText on each label.  This ends up being surprisingly CPU-intensive: on reasonably modern hardware (2012 MacBook Pro), I use 70% of one CPU.  This doesn’t leave me much overhead to do anything else.
>
> Are there any best practices to reduce CPU usage in this case?

Hm, I don't really have a good answer when it comes to optimizing it
the way you've stated it, but lets get a little philosophical instead:
What human operator of your GUI is going to be able to process all
this visual information? I would have a hard time monitoring even 5
labels of text updating at that rate.

My recommendation would be:

1. Consider if your really have to show all these sensors, or if the
information they're conveying can be aggregated in some way.
2. If you really need to visualize them all at once, consider a
simpler presentation than the numerical, such as a bar (should be
cheaper to redraw than a changing text).

Regarding 1, if the sensors can be grouped in some logical way, you
can present a collection of sensor groups instead. Regarding 2, if the
user wants to look closer at a single sensor, or maybe a (reasonably
sized) group of sensors, you could build some UI for that.

It would help to know a little more about the user story, is this for
monitoring a system for failures? If so, I think the rule of thumb is
that if nothing is out of the ordinary, the system should not look
visually "busy" (no big movements or bright colors, just subtle
gray/static text). That allows you to use visual movement and bright
colors for error conditions / anomalies. But yea, it would help to
know more about what the GUI is for :)

Hope that helps a little, even if it wasn't what you asked for.

Elvis

>
> Cheers,
> —Matt
>
> Matt Gibbs
> SLAC Accelerator Operations Group
> mgibbs at slac.stanford.edu
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list