A while back ago I realized the importance of variable types and code optimization. I was working on an interactive installation using an Arduino and a Mac Mini. The Mac was communicating with the Arduino through an XMLSocket and was getting data probably about one hundred times per second.
The first version of the datahandler used int’s as variable type for the values I recieved, and it would occasionally fail. After swithching to uint, things looked better.
I also had a set of 4 if-statements which I optimized by merging them into 2 if-statements.
To my surprise, this was the only thing I needed to do to make the datahandler parse the data fast enough.