I need a timer to be triggered every 1 ms. This document reports, that slot invocation may be much slower than even a virtual function call.
But if we compare signals/slots with event occurance, what mechanism will be faster, more efficient and produce less overhead: QTimer with it’s timeout() signal connected to a slot or bare QObject::startTimer()\ QObject::killTimer() with QObject::timerEvent()?
Will the answer for above question be the same for Windows and Linux?
QTimeris actually just a signal-slot wrapper around theQObject::startTimer()functionality, so it will undoubtedly have more overhead associated with it on all platforms (it internally implementsQObject::timerEvent()— its implementation of this function is just to emit thetimeout()signal).Of note,
QBasicTimeris a more light-weight wrapper around theQObject::startTimer()functionality. If you useQBasicTimer, you still have to implementQObject::timerEvent(), but it manages the timer ID for you. As such, aQBasicTimercombines some of the ease-of-use of aQTimerwith the efficiency of using theQObject::startTimer()mechanism.