https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63466
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- You're comparing apples and oranges. This function forces you to do additional allocations for the arguments, which has nothing to do with iostream performance: void __attribute__((noinline, noclone)) func(string &, string &) This allocates even more memory: istringstream iss(line); The expression (iss >> index >> s) is far more flexible than your C version, handling adjacent whitespace and being able to extract arbitrary types from the stream. If you don't need those extra allocations and flexibility then don't use them; your C code is a valid C++ program too. But rewriting your C++ code to be equivalent to the C code (e.g. by using std::string::find_first_of) would remove any use of stringstream, leaving only the performance of std::getline as a limiting factor, which is not the topic of this bug report. So if your point is simply "iostreams are slower than stdio" then yes, we know, welcome to 1998 ;-)