title: Is std::ifstream significantly slower than FILE?
body: <p>I've been informed that my library is slower than it should be, on the order of 30+ times too slow parsing a particular file (text file, size 326 kb). The user suggested that it may be that I'm using <code>std::ifstream</code> (presumably instead of <code>FILE</code>).</p>
  
  <p>I'd rather not blindly rewrite, so I thought I'd check here first, since my guess would be the bottleneck is elsewhere. I'm reading character by character, so the only functions I'm using are <code>get()</code>, <code>peek()</code>, and <code>tellg()/seekg()</code>.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I profiled, and got <a href="https://stackoverflow.com/questions/485649/confusing-gprof-output">confusing</a> output - gprof didn't appear to think that it took so long. I rewrote the program to read the entire file into a buffer first, and it sped up by about 100x. I think the problem may have been the <code>tellg()/seekg()</code> that took a long time, but gprof may have been unable to see that for some reason. In any case, <code>ifstream</code> does <em>not</em> appear to buffer the entire file, even for this size.</p>