This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/54393] std::getline is almost 10x slower when working on a vstring versus std::string
- From: "azanella at linux dot vnet.ibm.com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 28 Aug 2012 18:49:42 +0000
- Subject: [Bug libstdc++/54393] std::getline is almost 10x slower when working on a vstring versus std::string
- Auto-submitted: auto-generated
- References: <bug-54393-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54393
--- Comment #3 from Adhemerval Zanella <azanella at linux dot vnet.ibm.com> 2012-08-28 18:49:42 UTC ---
The default algorithm used on both std::string and __gnu_cxx::__vstring appends
data char by char. However, std::string also provides an template
specialization for both char and wchar_t (defined in src/istream.cc) which
appends the data from the stream using larger buffer (which is calculated by
finding the delimiter).
Based on that and following how std::string provides its template
specialization, I'm proposing a fix for the performance issue. This was made
against gcc-4.6 (I still working a patch for trunk) and I only update the
baseline_symbols for PPC64 (since it a still RFC patch).