c++ file parser slow compared to c# -


i need write file parser in c++.

here's code :

std::string line;        vector<string> slice;  while(getline(m_inputstream, line))   {            } 

my file big, loop takes 12 seconds.

my c# code :

streamreader sr = new streamreader(filename); string strline = "";  while (!sr.endofstream) {     strline = sr.readline(); } 

and takes 0.6 seconds... doing wrong in c++?

firstly, doing slice?

chances c# version reading string discarding - , c# jit optimising no-op, 0.6 seconds takes initialise , quit. c++ version generate code read string processing input file. make sure c++ 1 built release settings if you're going compare performance, debug code meaningless perf.

do string , you'll see different performance figures, , check memory usage in both systems, c# 1 use lot more ram until gc kicks in.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -