View Full Version : Serial.print(number) speedup for Teensy2

06-24-2013, 10:16 PM
In case anyone's interested, here's a thread over on the Arduino forum regarding an impressive optimization for divide-by-10.


I saw this on Sunday and started fiddling with the code to integrate it nicely with Teensy2's Print.cpp. The result is roughly 7X faster integer to ascii performance. If you're interested in tricky optimizations, this is definitely an impressive one!

This will probably be released in Teensyduino 1.16. I'm going to hold off putting it in 1.15, until it's been thoroughly tested.

Teensy 3.0 has built-in 2 cycle hardware 32 bit divide, so it does this operation well over 1000 times faster Teensy2. This speedup on Teensy2 might reduce that margin to only about 200X....