Conversation
|
Hi Raido, can you quantify the improvement? On what platform did you notice this to be a significant performance issue? We should be careful not to start changing files only because we don't like the existing style if the benefits from the change are marginal. --Vlado |
|
It was an old internal change that I stumbled upon, but if I remember correctly, then the modulus operator started to have a noticeable effect on performance when doing a lot of printf(which uses the queue internally) at high baudrates(like 500000) on an Atmel RFA1. Or rather we were able to print a lot more if we replaced the % operations. I can also refer to http://embeddedgurus.com/stack-overflow/2011/02/efficient-c-tip-13-use-the-modulus-operator-with-caution/ as a reason to avoid the % in such cases for AVR and MSP. This substitution will probably not have much effect for ARM, but I don't think it will hurt either. |
|
Changed the if to a while. I would expect the action to normally not run at all or run just once, so should still be better than the %. |
BigQueueC is faster when % is not used.