Solved Lagging window/gui when using realtime table view
-
@Mr-Gisa said in Lagging window/gui when using realtime table view:
if (mResults.contains(result)) { return; }
This is not a good idea...
- why should addResult() called twice with the same pointer? This can only happen due to wrong code on your side
- a linear lookup is maybe fast for < 100 lookups but not for huge data.
-
@Mr-Gisa said in Lagging window/gui when using realtime table view:
if (! index.isValid()) { return QVariant(); } if (index.row() >= mResults.size() || index.row() < 0) { return QVariant(); } auto result = mResults.at(index.row());
And here I would first check for the role, then the bounds and at last for the validity since this is the most expensive operation here.
-
@Christian-Ehrlicher I made the changes you pointed out and it helped a lot, it's still lagging, but way less than it was before. I can feel the gui freezing when trying to move, and as it's a lot of incoming data per second in the model you can really feel the lag in the gui.
I think you know a software called Wireshark, it was made using Qt and their table receives A LOT (way more than mine) of packets information and it doesn't lag at all, but in my application I can feel the lag when I try to move the window around while the results are being displayed in the table. -
Another idea is to collect some results and add them once in a second (or every n seconds) instead every single one.
-
I realized something. When I compile in release mode and run the application out of the Qt, like running the actual executable it doesn't lag. Why is that?
-
Because now the compiler don't need to generate debug information and compiles your code with optimizations.
-
You think I should leave that way getting results at real time or do the batched thing? What is the best alternative here?
-
@Mr-Gisa
Since you are planning on even higher payloads, you should test if release mode
can handle that or you simply need to batch them. -
It will have on average 100 or 200 thousand results.
-
@Mr-Gisa
and are you testing with that many now? -
5~10 thousands, I can't get to 100~200 cause I have to code the other APIs, but with that it's working normally at this point.
-
@Mr-Gisa
Ok, but you can postpone it until you have test data then and work on the other parts. -
Exactly, that is what I'm going to do. Thank you all for your help. If anything happen in the future I'll say it here.
I'm also going to get a copy with a friend of mine of his Intel Parallel Studio 2018 to check a few things in the application, I hope it works with Qt. -
@Mr-Gisa said in Lagging window/gui when using realtime table view:
Intel Parallel Studio 2018
Well its a compiler so good chance it can compile Qt.
-
I'm not going to use the compiler, but the Intel® Inspector and Intel® VTune™ Amplifier.
Intel® Inspector: Memory and Thread Debugger
Intel® VTune™ Amplifier: Performance Profiler -
@Mr-Gisa
Ok, but can it do it without touching the source code? -
Yes, but you can also specify the source code and it will show you the places that it has leaks and is slow, stuff like that.
-
@Mr-Gisa
Sounds really good. Never tested it. -
I recommend it, I'm not a pro using it but I could detect a lot of things in my code that helped me improve. Not in this one I mean, in other projects.I'm going to test using this one right now