On Mon, May 28, 2001 at 02:36:34PM +0200, Jean-Marc Lasgouttes wrote: > Dekel> BTW, the exact problem is in the line 'ostr << ifs.rdbuf();' in > Dekel> lyx::sum in support/lyxsum.C > > Could you come up with a small example? Compile the attached file (using -O2 optimization), and then run 'time test some-large-file' twice (the first run is to read the file into the memory cache). Use file of size ~5M. Compare the result with 'time cat some-large-file >/dev/null'
#include <fstream> #include <sstream> int main(int argc, char **argv) { std::ifstream ifs(argv[1]); std::ostringstream ostr; ostr << ifs.rdbuf(); string w = ostr.str(); cout << w.length() << endl; }