I am parsing a ~500GB log file and my C++ version takes 3.5 minutes and my Go version takes 1.2 minutes.
I am using C++'s streams to stream each line of the file in to parse.
#include <fstream>
#include <string>
#include <iostream>
int main( int argc , char** argv ) {
   int linecount = 0 ;
   std::string line ;
   std::ifstream infile( argv[ 1 ] ) ;
   if ( infile ) {
      while ( getline( infile , line ) ) {
          linecount++ ;
      }
      std::cout << linecount << ": " << line << '\n' ;
   }
   infile.close( ) ;
   return 0 ;
}
Firstly, why is it so slow to use this code? Secondly, how can I improve it to make it faster?
 
     
     
     
    