Slow performance and large memory usage with QTableView in Qt 5.15
-
@KaoN
Glancing, I think your code is OK for a test.You are creating 100,000 rows in your model. That in itself is OK (check the timing on just that). You are then asking
QTableView
to display all 100,000 rows, and at 100 columns per row. That's 10 million cells. That is not reasonable (IMO)! In a real-world scenario we would expect the model to contain less rows/columns, or we would expect you to use aQSortFilterProxyModel
to filter how much is shown to the user.Or, if you really insist on displaying that much data, people would implement a "paging" mechanism on the
QTableView
so that it only shows, say, 100 rows at a time, and the user has to move forward/backward by 100 row-pages. So that the view only actually displays 100 rows at a time. You will have seen that in lots of applications. -
@JonB Thank you for your suggest, but after several tries, I thought I might find a bug with Qt 5.15 at least.
Same code works fine with 5.9.9, fast and smooth, but fail to perform the same when I using the latest release, with memory usage nor CPU consumption.Should I open a bug for that ?
-
Your testapp opens instantly here on linux with 5.15.0 / 64 bit
-
@Christian-Ehrlicher thx for testing it for me
, then it might be a bug related to windows only? -
I also don't have problems with your example with Qt5.15.0 / MinGW64 on Windows 7. Please make sure that you have a clean build dir, maybe even create a new clean project to test it.
-
@Christian-Ehrlicher hmm..that's wierd, I did a clean project and using both MSVC and MinGW64 , same bad performance on Windows 10 1909, fine with 5.9.9
-
@KaoN Then please mark this topic as solved
-
@Christian-Ehrlicher done, but can't figure out what made that 'bug' happen
-
@KaoN said in Slow performance and large memory usage with QTableView in Qt 5.15:
After hibernating my desktop for a night, it slows again.. and...reboot does not work anymore..TT
Are you running out of RAM? I'm guessing that the slowdown happens when your PC is busy transferring data between your physical RAM and your Pagefile. That is a very slow process.
Run Resource Monitor (https://www.thewindowsclub.com/use-resource-monitor-windows-10 ) and see what is using up all your memory and your disk I/O.
-
@KaoN said in Slow performance and large memory usage with QTableView in Qt 5.15:
The question is with 5.9.9, it works fine, with only 10MB memory consumption.
It's possible that the implementation of QTableView changed between Qt 5.9 and Qt 5.15 which provides better performance in some use-cases but worse performance in other use-cases.
Do you have Qt 5.12 LTS installed? How does it perform with that version?
You can post your minimal test code and provide instructions on how to cause the slowdown to https://bugreports.qt.io/. However, it is still not clear to me whether it is a bug/regression or not.
-
I'm pretty sure your Qt example has nothing to do with this.