[Interest] Qt Performance : QT Widget Application vs WPF

André Pönitz apoenitz at t-online.de
Tue Mar 10 21:21:27 CET 2015


On Tue, Mar 10, 2015 at 12:19:42PM +0530, Chandralatha Harish wrote:
> Hi All,
> 
> I was trying to evaluate QT vs WPF in terms of Memory , Performance ,
> Window HAndles, User objects, GDI and so on..
> So built 2 identical looking controls in WPF and QT with all values
> harcoded.
> BAsically a usercontrol - which is "QFrame holding 3 Labels with text, 3
> labels with Images, 3 combo box, "
> and created the usercontrol in a loop of 100, 200 ,1000 , 10000 and so
> on... with the button click on the main window,
> The code in QT is as follows...
> 
> void MainWindow::on_pushButton_clicked()
> {
> QElapsedTimer myTimer;
> myTimer.start();
> 
> for(int i=0;i<100;i++)
> {
> 
> QListWidgetItem *item=new QListWidgetItem(ui->listWidget);
> UserControl *row=new UserControl (0);
> item->setSizeHint(row->maximumSize());
> ui->listWidget->setItemWidget(item,row);
> }
>  ui->timeLabel->setText( QString::number(myTimer.elapsed())+ " ms");
> 
> }
> 
> On Measuring the performance, with the above code in QT (vs WPF with very
> identical code in WPF)
> -> First of all in QT,I could notice a lot difference in performance
> measure between the debug build vs release build of QT( say if release
> build take 1.3 sec to create 200 controls debug build takes around 7 sec)

That's expected.

Release builds are typically done with an higher compiler optimization level.

> --> On creating 100 and 200 user controls the performance measures of WPF
> were identical to performance measures of release build in QT.

You do not compare "User Control construction times", you are comparing
a seemingly good WPF implementation with a wrong Qt implementation.

I am not sure what you do on the WPF side, but if you really use the
code you show up you have (at least) quadratic behaviour on the Qt side
as the geometry update is triggered on each insertion, and due to the
way you populate your list each geometry update iterates over all existing
items.

You are using the wrong view container here. QListWidget is a convenience
widget, good for a couple of dozen entries. For "heavy duty" (i.e. 100000+)
you should use some Q*View and a suitable model.

> --> but on increasing the loop size, i noticed QT performance was pretty
> bad w.r.t to WPF.
> for 1000 UserControls- WPF took - 7sec( creation + render time) and 137 MB
> of memory
> while QT took - 15 sec(creation+render time) and 147MB of memory
> for 10,000 usercontrols- WPF took - 79sec and 1 GB memory
> QT took - 22 mins for creation and rendering and 1GB of memory
> Note: Each UserControls Contains around 9 controls
> Can some one comment on
> -> Is QT Performance bad compared to WPF for huge number of controls?
> -> Is it the issue with the Rendering engine used by default. I'm using QT
> 5.4 64 bit Open source version of QT.
> -> the below states QT native rendering suffers with Performance issues -
> and Raster graphics to be used
> https://kjellkod.wordpress.com/2011/05/22/moving-to-qt5-will-that-remove-qts-performance-issues-on-linux/
> How to switch to Raster Graphics inQT 5? Understand that
> QApplication.SetGraphicsSystem has been deprecated in QT5.
> --> Is QT Quick better vs Widget application in terms of performance?

None of these questions are really relevant for your performance problem 
The answer to each of them would be "Unlikely", but to get reasonable
performance you need to chose a non-quadratic approach first.

Andre'



More information about the Interest mailing list