State estimation code installs sensorUpdatedCb handler on number of sensors objects, including high rate Gyro and Accel. Traditionally, callbacks are triggered from eventdispatcher (which is in turn run as callbackscheduler task), to ensure isolation from calling thread (I think, correct me if I'm wrong here).
However, as sensorUpdatedCb() is not doing pretty much anything other than setting flags and requesting callbackscheduler to dispatch StateEstimationCb, making a shortcut and skipping the eventdispatcher saves some cpu cycles and reduces latency with no side effects (given the simplicity of sensorUpdatedCb handler).
Also, similar place is in innerloop.c where GyroState callback only gets to request dispatching of stabilizationInnerloopTask().
Suggested improvement is to replace calls to
With xConnectFastCallback() versions, those which invoke callback directly, and not through eventdispatcher.
This improvement reduces overall CPU usage by 5% on F3 targets.