Holy crap. Turns out 95% of the time was spent on the fopen() call for writing a board