Before re-engineering your application, you should narrow down where the bottleneck is. To diagnose this, I would try logging the start and end of each read from your sensors to a string buffer you keep in memory. Do this for 30 seconds or so. Then, stop reading from the sensors and write the buffer to a log file. If the log file shows delays between the start and end of each of the sensor reads, then that's where the bottleneck is. If it doesn't, then the bottleneck is probably in continually writing your CSV file to disk.