Interacting with UI increases loop time in a separate worker thread
-
I'm working on a project using 2 high-speed (50.000 FPS) cameras and a QML interface. I have separate threads for each camera. On those threads I'm running simple infinite loops and process the frames as they come. Most of the time my program can keep up with the incoming 50k frames per second, keeping loop time around 20 microseconds. But around every 30 to 40 seconds I'm losing some frames, my loop time increases up to 25 microseconds.
After some messing around with the program I noticed that interacting with the UI, dragging one of it's corners very fast, for example, causes my loop time to increase up to 60 microseconds, even though I'm using just an empty application windows that has nothing in it and my worker threads are not sending/receiving any signals from the UI thread.
I know cpu has to switch threads but resizing an empty windows on a separate, independent thread can have this much affect on performance? Also I'm working with basler cameras if anyone's familiar, they have a program for configuring the cameras called PylonViewer. With this program I can view a live stream from cameras and regardless of how much I resize the UI, I don't lose any frames. I wonder how did they achieve that despite having a pretty complicated UI, especially compared to my empty window. And what can I do to improve performance of my program?