[Interest] Optimizing performance with hundreds of widgets

Viktor Engelmann viktor.engelmann at qt.io
Tue Feb 21 14:39:39 CET 2017



Am 15.02.2017 um 18:28 schrieb Gibbs, Matt:
> 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?
>
> 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

you might want to do

   setUpdatesEnabled(false);
   // do your updates
   setUpdatesEnabled(true);

-- 

Viktor Engelmann
Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin

Viktor.Engelmann at qt.io
+49 151 26784521

http://qt.io
Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 144331 B




More information about the Interest mailing list