[Interest] Optimizing performance with hundreds of widgets

Gibbs, Matt mgibbs at slac.stanford.edu
Tue Feb 21 22:35:41 CET 2017


Hi Guenter, thanks for the reply, and the sample code.

I’ll check it out - I bet having a very simple widget that only calls painter.drawText like yours will help.  I can’t go all the way to a single widget, unfortunately, but avoiding all the ‘fancy’ parts of QLabel is a good idea.

—Matt


> On Feb 21, 2017, at 06:36, Guenter Schwann <guenterlists at schwann.at> wrote:
> 
> On Mittwoch, 15. Februar 2017 17:28:22 CET 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.
> 
> I get about 25% CPU usage on my 2.5GHz Linux Notebook.
> And when I use a single custom widget to draw all texts in a single 
> paintEvent, CPU usage drops to about 15%.
> 
> https://gitlab.com/gschwann/WidgetsPerformance 
> 
> -- 
> Günter Schwann | Freelancing Software Engineer | Qt Expert
> Partner Consultant of Viking Software
> guenter at vikingsoft.eu
> 
> 



More information about the Interest mailing list