From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23553 invoked by alias); 28 Aug 2012 18:50:20 -0000 Received: (qmail 23542 invoked by uid 22791); 28 Aug 2012 18:50:19 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Aug 2012 18:50:07 +0000 From: "azanella at linux dot vnet.ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/54393] std::getline is almost 10x slower when working on a vstring versus std::string Date: Tue, 28 Aug 2012 18:50:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: azanella at linux dot vnet.ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-08/txt/msg01873.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54393 --- Comment #3 from Adhemerval Zanella 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).