Optimizing atof and strtod in MSVC 2008

When parsing a 3d mesh from an OBJ file, it is optimal to collapse equal vertices into an indexed list. This is one of the more complicated steps so my suspicion was that something went wrong there. I was using a hash table to do the comparisons so it should have been fast. I disabled that section of code, and timed the load again. It barely affected the result.
Another common pitfall when parsing files is getting stalls from seeking through the file itself. I had already taken that into consideration and just loaded the whole thing into memory for processing. I was out of ideas and decided to profile the load and see what I had done wrong. I learned that almost all of my time was spent in strlen which was a big red flag considering I never even called strlen during my entire load.
Continue reading...