Your question is Optimizing a Bottleneck Function. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
Walk me through how you would optimize a function that is causing a system bottleneck.
Explain how you would confirm the bottleneck, identify its limiting resource, choose an optimization, and validate that the change improves the intended system behavior. Keep the discussion focused on C or C++ code running on an embedded Linux target, including measurement, correctness, and regression validation.