Why is the signal and slot mechanism in Windows slower than Linux?
-
I wrote a program, which receives data via qtcpsocket and passes the data to another class using a signal to parse my own protocol. I first implemented this code on ubuntu and qt 5.14.2 and then compiled it on windows. In Linux, all received packets were processed in a stream by my parser without any problems, but in Windows, only one was processed for every 10 to 12 received packets, and the rest are delayed in the event queue. After some time, the RAM memory is filled from the accumulation of input signals to the queue.
I also wrote the same program with Qwebsocket, which also worked without problems in Linux, but in Windows it caused a lot of delay in the processing, causing the tcp window to fill up.
Please guide me. -
I wrote a program, which receives data via qtcpsocket and passes the data to another class using a signal to parse my own protocol. I first implemented this code on ubuntu and qt 5.14.2 and then compiled it on windows. In Linux, all received packets were processed in a stream by my parser without any problems, but in Windows, only one was processed for every 10 to 12 received packets, and the rest are delayed in the event queue. After some time, the RAM memory is filled from the accumulation of input signals to the queue.
I also wrote the same program with Qwebsocket, which also worked without problems in Linux, but in Windows it caused a lot of delay in the processing, causing the tcp window to fill up.
Please guide me. -
I added two counters to the program. One of the counters counts the number of received packets and the second counter counts the number of processed packets. In Linux, there is no difference between these two counters, but in Windows, the difference is 10 received packets to 1 processed packet.
-
hard to tell without a working crystal ball, mine is currently in repair - accumulated some cracks recently.
I'll try some standard questions/solutions:
- Maybe your Windows is running in a VM on your linux machine with the lowest settings possible ?
- Is one release and one a debug build ?
-
The operating systems used are windows 10 and linux ubuntu 20.04 and neither is a vm. Two independent operating systems on two separate ssd hard drives.
Both tests were done with the release version of the program.
On Windows, it has been tested with both msvc2017 and mingw, with similar results.
In addition, I got the same results on two other PCs and Windows was much slower than Linux. -
Are you actually processing all packets currently in the event loop on the receiving side? Or are you only processing one, then yielding?
The batching behavior and thread scheduling could be very different between windows and linux.
Also, is your CPU busy or idle?
Last but not least, have you tested with a newer Qt version, or checked for open issues in the Qt bug database?