News for hackers. Stuff that matters.
Re:Qt signal is ten times slower than a virtual function by xbar on Thursday August 11, 2022 @01:26PM (#32429051)
"Assume I receive 100,000 trades per second from some crypo exchange and if one trade triggers 100 signals than I have 10.000.000 signals per second that is something comparable with the maximum."

Computers work faster than people who click manually.

Re:Qt signal is ten times slower than a virtual function by skrebbel on Thursday August 11, 2022 @01:35PM (#32429189)
I strongly doubt the signals, even at 10x a virtual function call, are a bottleneck when handling 100k network requests in a second. When you're optimizing that deep, you can do that extra bit of work and replace the qt signal library by a real vtable. It's not what signals were designed for.
Re:Qt signal is ten times slower than a virtual function by marcodiego on Thursday August 11, 2022 @01:47PM (#32429346)
If you're using signals for anything that may reach "10.000.000 signals per second" then you're doing it wrong.

Sounds like the guy who wanted an event to be fired for each audio sample and required 44100 samples per second. Interestingly, qt signals maybe even fast enough for just that.

Re:Qt signal is ten times slower than a virtual function by halter73 on Thursday August 11, 2022 @01:36PM (#32429196)
Why would you use QT signals for that? The point is you do not have to interact with the UI at that high of a frequency.
Re:Qt signal is ten times slower than a virtual function by jonhohle on Thursday August 11, 2022 @01:39PM (#32429243)
Wait until he finds out the display refreshes at most 240 times per second…
Re:Qt signal is ten times slower than a virtual function by silon42 on Thursday August 11, 2022 @02:52PM (#32430124)
1000Hz polling on a mouse seems acceptable for gamers... (Google shows some mice supporting 8000Hz, but that seems like an overkill)
Re:Qt signal is ten times slower than a virtual function by dekhn on Thursday August 11, 2022 @01:35PM (#32429185)
This really sounds like a naive implementation expecting that naive use of a feature is perfectly optimized. IE, don't use that number of signals, or treat signals like a broadcasting message bus. 10X the cost of a virtual function call is pretty optimized, btw.
Re:Qt signal is ten times slower than a virtual function by dale_glass on Thursday August 11, 2022 @01:59PM (#32429488)
At some point you have to consider whether your way of doing things is at all sensible.

Signals are good for rare, unpredictable events. If you have a firehose worth of data coming in, you're not sitting around waiting very often. Your data probably also has some commonality to it, and can be handled in bulk. If you have 100K events coming in, they're probably events of the same type.

Just like if you're writing gigabytes to a file, a program written with the most minimum amount of intelligence isn't going to do it one character at a time.

Re:Qt signal is ten times slower than a virtual function by saidinesh5 on Thursday August 11, 2022 @02:31PM (#32429876)
Even if you are getting 100,000 events per second - your GUI only updates at 60fps or 120fps - so you'd want to batch those events and try to update the GUI only once every frame.

Also to process important incoming messages on the same thread as the main event loop - where other things like user input, application drawing is handled, is kind of a bad idea.