[Bug libstdc++/45574] New: ifstream::getline() is extremely slow

2010-09-06 Thread tstarling at wikimedia dot org
++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tstarling at wikimedia dot org GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45574

[Bug libstdc++/45574] ifstream::getline() is extremely slow

2010-09-07 Thread tstarling at wikimedia dot org
--- Comment #2 from tstarling at wikimedia dot org 2010-09-07 10:46 --- (In reply to comment #1) > If the problem is in the stdio sync code, then file a glibc PR. > I mean the "stdio sync code" as in the code in libstdc++ which synchronises with glibc, not actual code

[Bug libstdc++/45574] ifstream::getline() is extremely slow

2010-09-07 Thread tstarling at wikimedia dot org
--- Comment #4 from tstarling at wikimedia dot org 2010-09-07 17:18 --- Benchmarking on Solaris indicates that cin.getline() takes only 1us per iteration there, but I don't think the source code is available, so it's hard to provide details. However, I think that a huge spe

[Bug libstdc++/45574] ifstream::getline() is extremely slow

2010-09-07 Thread tstarling at wikimedia dot org
--- Comment #8 from tstarling at wikimedia dot org 2010-09-08 01:34 --- (In reply to comment #5) > For sure we cannot add virtual functions to basic_streambuf without breaking > the ABI. I'm mostly looking for a long-term fix, to improve the speed of libstdc++ application

[Bug libstdc++/45574] ifstream::getline() is extremely slow

2010-09-07 Thread tstarling at wikimedia dot org
--- Comment #9 from tstarling at wikimedia dot org 2010-09-08 02:36 --- Created an attachment (id=21732) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21732&action=view) 10 lines, 500 bytes per line Test file attached as requested, compressed with gzip. Test code

[Bug libstdc++/45574] cin.getline() is extremely slow

2010-09-08 Thread tstarling at wikimedia dot org
--- Comment #14 from tstarling at wikimedia dot org 2010-09-09 02:31 --- (In reply to comment #11) > So? We are not changing glibc here. The C++ library does *not* use buffering > in > the synced mode, and it does otherwise, for fstreams in particular. Where do > y

[Bug libstdc++/45574] cin.getline() is extremely slow

2010-09-09 Thread tstarling at wikimedia dot org
--- Comment #18 from tstarling at wikimedia dot org 2010-09-09 14:12 --- Created an attachment (id=21752) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21752&action=view) gprof output I haven't managed to get libstdc++ to compile with -pg, but compiling the test

[Bug libstdc++/45574] cin.getline() is extremely slow

2010-09-09 Thread tstarling at wikimedia dot org
--- Comment #19 from tstarling at wikimedia dot org 2010-09-09 14:28 --- (In reply to comment #16) > The *_unlocked versions are faster a lot actually, at least for the one > character ops, because no locking is performed and the calls are inlined. > But the question is whethe

[Bug libstdc++/45574] cin.getline() is extremely slow

2010-09-09 Thread tstarling at wikimedia dot org
--- Comment #23 from tstarling at wikimedia dot org 2010-09-10 00:17 --- (In reply to comment #21) > Anyway, not sure which STL getline we are talking about here, because e.g. > src/istream.cc getline seems to access the stdio buffer directly: > streamsi

[Bug libstdc++/45574] cin.getline() is extremely slow

2010-09-10 Thread tstarling at wikimedia dot org
--- Comment #24 from tstarling at wikimedia dot org 2010-09-10 15:25 --- Created an attachment (id=21766) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21766&action=view) dynamic_cast<> hack The attached patch uses a dynamic_cast<> hack to avoid the need