I have converted this simple method from C# to C++. It reads a path table and populates a list of lists of ints (or a vector of vectors of ints).
A sample line from
I profiled the code with Very Sleepy (Visual C++ 2010, 32-bit Windows XP). I don't know how similar my input data was, but here are the results anyway:
39% of the time was spent in basic_istream::operator>>
12% basic_iostream::basic_iostream
9% operator+
8% _Mutex::Mutex
5% getline
5% basic_stringbuf::_Init
4% locale::_Locimp::_Addfac
4% vector::reserve
4% basic_string::assign
3% operator delete
2% basic_Streambuf::basic_streambuf
1% Wcsxfrm
5% other functions
Some of the stuff seems to be from inlined calls so it's a bit difficult to say where it actually comes from. But you can still get the idea. The only thing that should do I/O here is getline and that takes only 5%. The rest is overhead from stream and string operations. C++ streams are slow as hell.