Program created with Qt running slower than expected
-
I have a program made with Qt 5.15 that reads physiological data from a sensor and displays data on the screen in real time. The device sends data at a rate of 250 samples per second. The GUI contains some graphs and other objects -- not too many of them.
The program starts running at a reasonable pace, but it gets progressivelly slower during the runtime as the streaming data gets in.The objects have circular buffers of a reasonable size.
There's no excessive usage of CPU or memory.
Running on Windows 10 64bit.
The program is built in 32bit architecture (limitation imposed by the device's library).Any thoughts on what I could try to improve the speed and make it run more smoothly? Thank you.
-
I have a program made with Qt 5.15 that reads physiological data from a sensor and displays data on the screen in real time. The device sends data at a rate of 250 samples per second. The GUI contains some graphs and other objects -- not too many of them.
The program starts running at a reasonable pace, but it gets progressivelly slower during the runtime as the streaming data gets in.The objects have circular buffers of a reasonable size.
There's no excessive usage of CPU or memory.
Running on Windows 10 64bit.
The program is built in 32bit architecture (limitation imposed by the device's library).Any thoughts on what I could try to improve the speed and make it run more smoothly? Thank you.
@Linhares said in Program created with Qt running slower than expected:
Any thoughts on what I could try to improve the speed and make it run more smoothly? Thank you.
Don't show all 250 samples per second but only 1 - the rest can't be visually seen by the user anyway.
If there is no CPU load problem then maybe it's a memory leak problem - check if you don't leak a lot of memory. -
I have a program made with Qt 5.15 that reads physiological data from a sensor and displays data on the screen in real time. The device sends data at a rate of 250 samples per second. The GUI contains some graphs and other objects -- not too many of them.
The program starts running at a reasonable pace, but it gets progressivelly slower during the runtime as the streaming data gets in.The objects have circular buffers of a reasonable size.
There's no excessive usage of CPU or memory.
Running on Windows 10 64bit.
The program is built in 32bit architecture (limitation imposed by the device's library).Any thoughts on what I could try to improve the speed and make it run more smoothly? Thank you.
@Linhares said:
The device sends data at a rate of 250 samples per second
Are you updating the screen after each new sample? If yes then does your device actually have 250Hz display?
If not then you're probably flooding your event queue with updates your hardware can't physically handle that fast. In that case buffer the data and handle it in bursts at a rate of your actual display. -
@Linhares said in Program created with Qt running slower than expected:
Any thoughts on what I could try to improve the speed and make it run more smoothly? Thank you.
Don't show all 250 samples per second but only 1 - the rest can't be visually seen by the user anyway.
If there is no CPU load problem then maybe it's a memory leak problem - check if you don't leak a lot of memory.@Christian-Ehrlicher said in Program created with Qt running slower than expected:
@Linhares said in Program created with Qt running slower than expected:
Any thoughts on what I could try to improve the speed and make it run more smoothly? Thank you.
Don't show all 250 samples per second but only 1 - the rest can't be visually seen by the user anyway.
If there is no CPU load problem then maybe it's a memory leak problem - check if you don't leak a lot of memory.I need to draw graphs that show most of the data (EEG traces, for instance). In graphs like these, I'm usually using 1 sample out 4 to reduce the amount of data to be displayed.
@Chris-Kawa said in Program created with Qt running slower than expected:
@Linhares said:
The device sends data at a rate of 250 samples per second
Are you updating the screen after each new sample? If yes then does your device actually have 250Hz display?
If not then you're probably flooding your event queue with updates your hardware can't physically handle that fast. In that case buffer the data and handle it in bursts at a rate of your actual display.No, I'm not updating after each new sample. I'm using buffers and each object updates once it has got a certain number of new samples (the exact number varies from one object to other -- I think the fastest one updates every 30 milliseconds).
One thing I've just thought: each object updates independently of the other objects. Could this be a problem?
Also, how fast should the changes be so that the hardware can handle them? -
@Christian-Ehrlicher said in Program created with Qt running slower than expected:
@Linhares said in Program created with Qt running slower than expected:
Any thoughts on what I could try to improve the speed and make it run more smoothly? Thank you.
Don't show all 250 samples per second but only 1 - the rest can't be visually seen by the user anyway.
If there is no CPU load problem then maybe it's a memory leak problem - check if you don't leak a lot of memory.I need to draw graphs that show most of the data (EEG traces, for instance). In graphs like these, I'm usually using 1 sample out 4 to reduce the amount of data to be displayed.
@Chris-Kawa said in Program created with Qt running slower than expected:
@Linhares said:
The device sends data at a rate of 250 samples per second
Are you updating the screen after each new sample? If yes then does your device actually have 250Hz display?
If not then you're probably flooding your event queue with updates your hardware can't physically handle that fast. In that case buffer the data and handle it in bursts at a rate of your actual display.No, I'm not updating after each new sample. I'm using buffers and each object updates once it has got a certain number of new samples (the exact number varies from one object to other -- I think the fastest one updates every 30 milliseconds).
One thing I've just thought: each object updates independently of the other objects. Could this be a problem?
Also, how fast should the changes be so that the hardware can handle them?One thing I've just thought: each object updates independently of the other objects. Could this be a problem?
Only you can check :)
Also, how fast should the changes be so that the hardware can handle them?
You can update a circular buffer 250 times a second with no problem. Unless that update is somehow super heavy that's a drop in a bucket. As for displaying I can't tell you, I don't know your hardware ;) Usually lower to mid range consumer grade monitors update at 60Hz, which means every 16.666ms.
each object updates once it has got a certain number of new samples
I would say change that to a steady interval and update all objects with significant amount of new data at once. As a bonus you'll wake up CPU less this way, saving some power (energy prices are so high these days... ).