Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 49910 invoked from network); 10 Dec 2007 07:07:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Dec 2007 07:07:13 -0000 Received: (qmail 16188 invoked by uid 500); 10 Dec 2007 07:07:01 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 16177 invoked by uid 500); 10 Dec 2007 07:07:01 -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 16166 invoked by uid 99); 10 Dec 2007 07:07:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Dec 2007 23:07:01 -0800 X-ASF-Spam-Status: No, hits=-98.7 required=10.0 tests=ALL_TRUSTED,URI_HEX 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; Mon, 10 Dec 2007 07:06:40 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 1AD4671425F for ; Sun, 9 Dec 2007 23:06:44 -0800 (PST) Message-ID: <12488975.1197270404106.JavaMail.jira@brutus> Date: Sun, 9 Dec 2007 23:06:44 -0800 (PST) From: "Martin Sebor (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Updated: (STDCXX-231) std::getline from header is rather slow In-Reply-To: <15668589.1151520029994.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-231?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Sebor updated STDCXX-231: -------------------------------- Severity: Inefficiency Affects Version/s: 4.1.2 4.1.3 4.1.4 4.2.0 Fix Version/s: 4.2.1 Affects all released versions. Let's try to look into speeding this up in 4.2.1. > std::getline from header is rather slow > ------------------------------------------------ > > Key: STDCXX-231 > URL: https://issues.apache.org/jira/browse/STDCXX-231 > Project: C++ Standard Library > Issue Type: Improvement > Components: 21. Strings > Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0 > Reporter: Martin Sebor > Fix For: 4.2.1 > > > Moved from the Rogue Wave bug tracking database: > ****Created By: leroy @ Jan 25, 2001 03:20:01 PM**** > Environment > Compiler : SUNPRO 4.2 > OS : Solaris 2.5.1 > SCL : 1.3.0 (Summer-1999) > Tools : 7.1.0 (Summer-1999) --> Use only for RWBench > Command line option : > for debug :=20 > CC -xildoff +w +p -g -o Test_dbg.exe test.cc -DRWDEBUG=3D1 -I/opt/Rogue= Wave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s -I/opt/RogueWave/Summer= -1999/workspaces/SOLARIS251/SUNPRO42/11s/include -I. -L/opt/RogueWave/Summe= r-1999/workspaces/SOLARIS251/SUNPRO42/11s/lib -Bstatic -ltls11s -lstd11s -B= dynamic > for release : > CC -xildoff +w +p -fast -o Test_release.exe test.cc -I/opt/RogueWave/Summ= er-1999/workspaces/SOLARIS251/SUNPRO42/8s -I/opt/RogueWave/Summer-1999/work= spaces/SOLARIS251/SUNPRO42/8s/include -I. -L/opt/RogueWave/Summer-1999/work= spaces/SOLARIS251/SUNPRO42/8s/lib -Bstatic -ltls8s -lstd8s -Bdynamic > (Uploaded file: 997149-test.cc) = = = = = =20 > **** Entered By: Web @ Thursday, January 25, 2001 2:41:42 AM ****=20 > Location of uploaded file:=20 > http://thoth.bco.roguewave.com/uploads/997149-test.cc > View all uploaded files for this incident:=20 > http://webdev.roguewave.com/admin/tsvw/index.cfm?IncidentID=3D997149 = = = = = = = = = = = = = = = =20 > **** Entered By: Web @ Thursday, January 25, 2001 2:44:56 AM ****=20 > #web > Please find my test case at the end of the note > Environment > Compiler : SUNPRO 4.2 > OS : Solaris 2.5.1 > SCL : 1.3.0 (Summer-1999) > Tools : 7.1.0 (Summer-1999) --> Use only for RWBench > Command line option : > for debug :=20 > CC -xildoff +w +p -g -o Test_dbg.exe test.cc -DRWDEBUG=3D1 -I/opt/Rogue= Wave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s -I/opt/RogueWave/Summer= -1999/workspaces/SOLARIS251/SUNPRO42/11s/include -I. -L/opt/RogueWave/Summe= r-1999/workspaces/SOLARIS251/SUNPRO42/11s/lib -Bstatic -ltls11s -lstd11s -B= dynamic > for release : > CC -xildoff +w +p -fast -o Test_release.exe test.cc -I/opt/RogueWave/Summ= er-1999/workspaces/SOLARIS251/SUNPRO42/8s -I/opt/RogueWave/Summer-1999/work= spaces/SOLARIS251/SUNPRO42/8s/include -I. -L/opt/RogueWave/Summer-1999/work= spaces/SOLARIS251/SUNPRO42/8s/lib -Bstatic -ltls8s -lstd8s -Bdynamic > #Code > #include > #include > #include > #include > =20 > =20 > class std_string_getline : public RWBench > { > public: > std_string_getline() {;} > =20 > void doLoop(unsigned long n); > void idleLoop(unsigned long n); > void what(ostream& os) const { os << "Standard String Getline : " << e= ndl;} > }; > =20 > class classic_getline : public RWBench > { > public: > classic_getline() {;} > =20 > void doLoop(unsigned long n); > void idleLoop(unsigned long n); > void what(ostream& os) const { os << "Classic Getline : " << endl;} > }; > =20 > int > main(int argc, char** argv) > { > =20 > std_string_getline test_std_string; > test_std_string.parse(argc, argv); > test_std_string.go(); > test_std_string.report(cout); > =20 > classic_getline test_classic_getline; > test_classic_getline.parse(argc, argv); > test_classic_getline.go(); > test_classic_getline.report(cout); > } > =20 > void > std_string_getline::doLoop(unsigned long n) > { > while (n--) > { > ifstream toRead(__FILE__); > string line; > line.reserve(512); > =20 > while (!(toRead.eof())) > { > getline(toRead, line, '\n'); > } > } > } > =20 > void > std_string_getline::idleLoop(unsigned long n) > { > while (n--) > { > ifstream toRead(__FILE__); > string line; > line.reserve(512); > } > } > =20 > void > classic_getline::doLoop(unsigned long n) > { > while (n--) > { > ifstream toRead(__FILE__); > char cLine[512]; > string line; > line.reserve(512); > =20 > while (!(toRead.eof())) > { > toRead.getline(cLine, 512); > line =3D cLine; > } > } > } > =20 > void > classic_getline::idleLoop(unsigned long n) > { > while (n--) > { > ifstream toRead(__FILE__); > char cLine[512]; > string line; > line.reserve(512); > } > } > #EndCode =20 > There appears to be something to this. I ran the program and here is the= output: > Sun C++=20 > Standard String Getline :=20 > Iterations: 1 > Inner loop operations: 1000 > Total operations: 1000 > Elapsed (user) time: 18.18 > Operations per second: 55.0055 > Sun C++=20 > Classic Getline :=20 > Iterations: 5 > Inner loop operations: 1000 > Total operations: 5000 > Elapsed (user) time: 4.67 > Kilo-operations per second: 1.07066 --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.