[Interest] Optimizing performance with hundreds of widgets
André Pönitz
apoenitz at t-online.de
Tue Feb 21 18:23:12 CET 2017
On Wed, Feb 15, 2017 at 05:28:22PM +0000, Gibbs, Matt wrote:
> 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?
If the labels simply display some text I'd finger-paint that in
the paint event. Or, if it needs to be scrollable/have some
table-like interaction then a QTableView with a simple
QAbstractTableModel implementation and an item delegate for
the actual painting.
Andre'
More information about the Interest
mailing list