Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 68659 invoked from network); 8 Sep 2007 01:04:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Sep 2007 01:04:51 -0000 Received: (qmail 27762 invoked by uid 500); 8 Sep 2007 01:04:45 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 27749 invoked by uid 500); 8 Sep 2007 01:04:45 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 27738 invoked by uid 99); 8 Sep 2007 01:04:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Sep 2007 18:04:45 -0700 X-ASF-Spam-Status: No, hits=-98.8 required=10.0 tests=ALL_TRUSTED,DNS_FROM_DOB,RCVD_IN_DOB X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Sep 2007 01:04:51 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0F2A0714209 for ; Fri, 7 Sep 2007 18:04:31 -0700 (PDT) Message-ID: <3968077.1189213471059.JavaMail.jira@brutus> Date: Fri, 7 Sep 2007 18:04:31 -0700 (PDT) From: "Travis Vitek (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Updated: (STDCXX-493) std::string::append() slow In-Reply-To: <20029614.1185142471044.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Travis Vitek updated STDCXX-493: -------------------------------- Attachment: stdcxx-493.patch Yes, I believe that this patch is good. It doesn't cause any regressions, and the performance is significantly improved for one of the cases in the test [op == 1]. I see similar results on windows. I'm attaching an updated patch that can be applied more easily. 2007-09-07 Mark Brown STDCXX-493 string (append): replace calls to replace with calls to append to improve performance. > std::string::append() slow > -------------------------- > > Key: STDCXX-493 > URL: https://issues.apache.org/jira/browse/STDCXX-493 > Project: C++ Standard Library > Issue Type: Bug > Components: 21. Strings > Affects Versions: 4.1.3 > Environment: gcc 4.1.2 on Linux/x86_64 > Reporter: Mark Brown > Assignee: Travis Vitek > Fix For: 4.2 > > Attachments: stdcxx-493.patch > > > This is a similar problem to STDCXX-492: all overloads of string::append() are slower than the same overloads in gcc: > $ let n=0; while [ $n -lt 3 ]; do time LD_LIBRARY_PATH=../lib ./append-stdcxx-4.1.3 500000000 $n; let n=`expr $n + 1`; done > real 0m11.221s > user 0m9.941s > sys 0m1.104s > real 0m13.065s > user 0m11.661s > sys 0m1.236s > real 0m7.837s > user 0m6.660s > sys 0m1.160s > $ let n=0; while [ $n -lt 3 ]; do time ./append-gcc-4.1.2 500000000 $n; let n=`expr $n + 1`; done > real 0m4.865s > user 0m4.172s > sys 0m0.692s > real 0m7.617s > user 0m6.920s > sys 0m0.696s > real 0m5.787s > user 0m5.068s > sys 0m0.720s > The program I used to do the comaprison is below: > #include > #include > #include > int main (int argc, char *argv[]) > { > const int N = argc < 2 ? 1 : std::atoi (argv [1]); > const int op = argc < 3 ? 0 : std::atoi (argv [2]); > std::string str; > const std::string x ("X"); > if (op == 0) { > for (int i = 0; i < N; ++i) > str.append (1, 'x'); > } else if (op == 1) { > for (int i = 0; i < N; ++i) > str.append ("x"); > } else { > for (int i = 0; i < N; ++i) > str.append (x); > } > assert (str.size () == std::size_t (N)); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.