eRCaGuy_TimerCounter icon indicating copy to clipboard operation
eRCaGuy_TimerCounter copied to clipboard

Recommend using Multiply vs Divide in get_micros()

Open filmo opened this issue 8 years ago • 1 comments

On Arduinos multiply is about 39x faster than divide. Thus multiplying by 0.50 rather than dividing by 2.0 might make a difference on the get_micros() routine.

filmo avatar Jan 02 '18 01:01 filmo

yeah I think you're right. Here's some more speed test info: https://playground.arduino.cc/Main/ShowInfo. Really though I recommend you just use get_count() if you want good speed. Avoid the floating point operations altogether. I made get_micros() return a float essentially for those less experienced who are likely using floating point variables and math instead of integer math anyway.

I'll fix it anyway when I get the chance.

ElectricRCAircraftGuy avatar Jan 02 '18 02:01 ElectricRCAircraftGuy