You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2006/06/28 20:40:29 UTC
[jira] Created: (STDCXX-231) std::getline from header is
rather slow
std::getline from <string> header is rather slow
------------------------------------------------
Key: STDCXX-231
URL: http://issues.apache.org/jira/browse/STDCXX-231
Project: C++ Standard Library
Type: Improvement
Components: 21. Strings
Reporter: Martin Sebor
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 :
CC -xildoff +w +p -g -o Test_dbg.exe test.cc -DRWDEBUG=1 -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/lib -Bstatic -ltls11s -lstd11s -Bdynamic
for release :
CC -xildoff +w +p -fast -o Test_release.exe test.cc -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/lib -Bstatic -ltls8s -lstd8s -Bdynamic
(Uploaded file: 997149-test.cc)
**** Entered By: Web @ Thursday, January 25, 2001 2:41:42 AM ****
Location of uploaded file:
http://thoth.bco.roguewave.com/uploads/997149-test.cc
View all uploaded files for this incident:
http://webdev.roguewave.com/admin/tsvw/index.cfm?IncidentID=997149
**** Entered By: Web @ Thursday, January 25, 2001 2:44:56 AM ****
#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 :
CC -xildoff +w +p -g -o Test_dbg.exe test.cc -DRWDEBUG=1 -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/lib -Bstatic -ltls11s -lstd11s -Bdynamic
for release :
CC -xildoff +w +p -fast -o Test_release.exe test.cc -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/lib -Bstatic -ltls8s -lstd8s -Bdynamic
#Code
#include <string>
#include <fstream.h>
#include <iostream.h>
#include <rw/bench.h>
class std_string_getline : public RWBench
{
public:
std_string_getline() {;}
void doLoop(unsigned long n);
void idleLoop(unsigned long n);
void what(ostream& os) const { os << "Standard String Getline : " << endl;}
};
class classic_getline : public RWBench
{
public:
classic_getline() {;}
void doLoop(unsigned long n);
void idleLoop(unsigned long n);
void what(ostream& os) const { os << "Classic Getline : " << endl;}
};
int
main(int argc, char** argv)
{
std_string_getline test_std_string;
test_std_string.parse(argc, argv);
test_std_string.go();
test_std_string.report(cout);
classic_getline test_classic_getline;
test_classic_getline.parse(argc, argv);
test_classic_getline.go();
test_classic_getline.report(cout);
}
void
std_string_getline::doLoop(unsigned long n)
{
while (n--)
{
ifstream toRead(__FILE__);
string line;
line.reserve(512);
while (!(toRead.eof()))
{
getline(toRead, line, '\n');
}
}
}
void
std_string_getline::idleLoop(unsigned long n)
{
while (n--)
{
ifstream toRead(__FILE__);
string line;
line.reserve(512);
}
}
void
classic_getline::doLoop(unsigned long n)
{
while (n--)
{
ifstream toRead(__FILE__);
char cLine[512];
string line;
line.reserve(512);
while (!(toRead.eof()))
{
toRead.getline(cLine, 512);
line = cLine;
}
}
}
void
classic_getline::idleLoop(unsigned long n)
{
while (n--)
{
ifstream toRead(__FILE__);
char cLine[512];
string line;
line.reserve(512);
}
}
#EndCode
There appears to be something to this. I ran the program and here is the output:
Sun C++
Standard String Getline :
Iterations: 1
Inner loop operations: 1000
Total operations: 1000
Elapsed (user) time: 18.18
Operations per second: 55.0055
Sun C++
Classic Getline :
Iterations: 5
Inner loop operations: 1000
Total operations: 5000
Elapsed (user) time: 4.67
Kilo-operations per second: 1.07066
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Updated: (STDCXX-231) std::getline from header is
rather slow
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-231?page=com.atlassian.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 <string> 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 :
> CC -xildoff +w +p -g -o Test_dbg.exe test.cc -DRWDEBUG=1 -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/lib -Bstatic -ltls11s -lstd11s -Bdynamic
> for release :
> CC -xildoff +w +p -fast -o Test_release.exe test.cc -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/lib -Bstatic -ltls8s -lstd8s -Bdynamic
> (Uploaded file: 997149-test.cc)
> **** Entered By: Web @ Thursday, January 25, 2001 2:41:42 AM ****
> Location of uploaded file:
> http://thoth.bco.roguewave.com/uploads/997149-test.cc
> View all uploaded files for this incident:
> http://webdev.roguewave.com/admin/tsvw/index.cfm?IncidentID=997149
> **** Entered By: Web @ Thursday, January 25, 2001 2:44:56 AM ****
> #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 :
> CC -xildoff +w +p -g -o Test_dbg.exe test.cc -DRWDEBUG=1 -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/lib -Bstatic -ltls11s -lstd11s -Bdynamic
> for release :
> CC -xildoff +w +p -fast -o Test_release.exe test.cc -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/lib -Bstatic -ltls8s -lstd8s -Bdynamic
> #Code
> #include <string>
> #include <fstream.h>
> #include <iostream.h>
> #include <rw/bench.h>
>
>
> class std_string_getline : public RWBench
> {
> public:
> std_string_getline() {;}
>
> void doLoop(unsigned long n);
> void idleLoop(unsigned long n);
> void what(ostream& os) const { os << "Standard String Getline : " << endl;}
> };
>
> class classic_getline : public RWBench
> {
> public:
> classic_getline() {;}
>
> void doLoop(unsigned long n);
> void idleLoop(unsigned long n);
> void what(ostream& os) const { os << "Classic Getline : " << endl;}
> };
>
> int
> main(int argc, char** argv)
> {
>
> std_string_getline test_std_string;
> test_std_string.parse(argc, argv);
> test_std_string.go();
> test_std_string.report(cout);
>
> classic_getline test_classic_getline;
> test_classic_getline.parse(argc, argv);
> test_classic_getline.go();
> test_classic_getline.report(cout);
> }
>
> void
> std_string_getline::doLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> string line;
> line.reserve(512);
>
> while (!(toRead.eof()))
> {
> getline(toRead, line, '\n');
> }
> }
> }
>
> void
> std_string_getline::idleLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> string line;
> line.reserve(512);
> }
> }
>
> void
> classic_getline::doLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> char cLine[512];
> string line;
> line.reserve(512);
>
> while (!(toRead.eof()))
> {
> toRead.getline(cLine, 512);
> line = cLine;
> }
> }
> }
>
> void
> classic_getline::idleLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> char cLine[512];
> string line;
> line.reserve(512);
> }
> }
> #EndCode
> There appears to be something to this. I ran the program and here is the output:
> Sun C++
> Standard String Getline :
> Iterations: 1
> Inner loop operations: 1000
> Total operations: 1000
> Elapsed (user) time: 18.18
> Operations per second: 55.0055
> Sun C++
> Classic Getline :
> Iterations: 5
> Inner loop operations: 1000
> Total operations: 5000
> Elapsed (user) time: 4.67
> Kilo-operations per second: 1.07066
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (STDCXX-231) std::getline from header is
rather slow
Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Travis Vitek reassigned STDCXX-231:
-----------------------------------
Assignee: Travis Vitek
> std::getline from <string> 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
> Assignee: Travis Vitek
> 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 :
> CC -xildoff +w +p -g -o Test_dbg.exe test.cc -DRWDEBUG=1 -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/lib -Bstatic -ltls11s -lstd11s -Bdynamic
> for release :
> CC -xildoff +w +p -fast -o Test_release.exe test.cc -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/lib -Bstatic -ltls8s -lstd8s -Bdynamic
> (Uploaded file: 997149-test.cc)
> **** Entered By: Web @ Thursday, January 25, 2001 2:41:42 AM ****
> Location of uploaded file:
> http://thoth.bco.roguewave.com/uploads/997149-test.cc
> View all uploaded files for this incident:
> http://webdev.roguewave.com/admin/tsvw/index.cfm?IncidentID=997149
> **** Entered By: Web @ Thursday, January 25, 2001 2:44:56 AM ****
> #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 :
> CC -xildoff +w +p -g -o Test_dbg.exe test.cc -DRWDEBUG=1 -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/lib -Bstatic -ltls11s -lstd11s -Bdynamic
> for release :
> CC -xildoff +w +p -fast -o Test_release.exe test.cc -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/lib -Bstatic -ltls8s -lstd8s -Bdynamic
> #Code
> #include <string>
> #include <fstream.h>
> #include <iostream.h>
> #include <rw/bench.h>
>
>
> class std_string_getline : public RWBench
> {
> public:
> std_string_getline() {;}
>
> void doLoop(unsigned long n);
> void idleLoop(unsigned long n);
> void what(ostream& os) const { os << "Standard String Getline : " << endl;}
> };
>
> class classic_getline : public RWBench
> {
> public:
> classic_getline() {;}
>
> void doLoop(unsigned long n);
> void idleLoop(unsigned long n);
> void what(ostream& os) const { os << "Classic Getline : " << endl;}
> };
>
> int
> main(int argc, char** argv)
> {
>
> std_string_getline test_std_string;
> test_std_string.parse(argc, argv);
> test_std_string.go();
> test_std_string.report(cout);
>
> classic_getline test_classic_getline;
> test_classic_getline.parse(argc, argv);
> test_classic_getline.go();
> test_classic_getline.report(cout);
> }
>
> void
> std_string_getline::doLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> string line;
> line.reserve(512);
>
> while (!(toRead.eof()))
> {
> getline(toRead, line, '\n');
> }
> }
> }
>
> void
> std_string_getline::idleLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> string line;
> line.reserve(512);
> }
> }
>
> void
> classic_getline::doLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> char cLine[512];
> string line;
> line.reserve(512);
>
> while (!(toRead.eof()))
> {
> toRead.getline(cLine, 512);
> line = cLine;
> }
> }
> }
>
> void
> classic_getline::idleLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> char cLine[512];
> string line;
> line.reserve(512);
> }
> }
> #EndCode
> There appears to be something to this. I ran the program and here is the output:
> Sun C++
> Standard String Getline :
> Iterations: 1
> Inner loop operations: 1000
> Total operations: 1000
> Elapsed (user) time: 18.18
> Operations per second: 55.0055
> Sun C++
> Classic Getline :
> Iterations: 5
> Inner loop operations: 1000
> Total operations: 5000
> Elapsed (user) time: 4.67
> Kilo-operations per second: 1.07066
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-231) std::getline from header is
rather slow
Posted by "Mark Brown (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12537089 ]
Mark Brown commented on STDCXX-231:
-----------------------------------
I just benchmarked getline() from stdcxx 4.1.3 against the same function in gcc 4.1 (the program is below), and out of curiosity against the wc utility on Linux. stdcxx is more than twice slower than gcc, and nearly ten times slower than wc.The timings for a 32MB text file are:
$ ls -l input.txt && time LD_LIBRARY_PATH=../lib ./getline 1 input.txt && time ./a.out 1 input.txt && time wc -l input.txt && cat getline.cpp
-rw-rw-r-- 1 mbrown mbrown 32942720 Oct 23 11:30 input.txt
892370
real 0m0.433s
user 0m0.400s
sys 0m0.036s
892370
real 0m0.149s
user 0m0.124s
sys 0m0.024s
892370 input.txt
real 0m0.053s
user 0m0.048s
sys 0m0.004s
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <string>
int main (int argc, char *argv[])
{
unsigned long loops;
const char* file;
loops = 1 < argc ? strtoul (argv [1], 0, 0) : 1;
file = 2 < argc ? argv [2] : __FILE__;
unsigned long line_count = 0;
std::string line;
for (unsigned long i = 0; i != loops; ++i) {
std::ifstream in (file);
if (!in.is_open ())
return 1;
while (std::getline (in, line))
++line_count;
}
printf ("%lu\n", line_count);
}
> std::getline from <string> 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
> Reporter: Martin Sebor
>
> 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 :
> CC -xildoff +w +p -g -o Test_dbg.exe test.cc -DRWDEBUG=1 -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/lib -Bstatic -ltls11s -lstd11s -Bdynamic
> for release :
> CC -xildoff +w +p -fast -o Test_release.exe test.cc -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/lib -Bstatic -ltls8s -lstd8s -Bdynamic
> (Uploaded file: 997149-test.cc)
> **** Entered By: Web @ Thursday, January 25, 2001 2:41:42 AM ****
> Location of uploaded file:
> http://thoth.bco.roguewave.com/uploads/997149-test.cc
> View all uploaded files for this incident:
> http://webdev.roguewave.com/admin/tsvw/index.cfm?IncidentID=997149
> **** Entered By: Web @ Thursday, January 25, 2001 2:44:56 AM ****
> #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 :
> CC -xildoff +w +p -g -o Test_dbg.exe test.cc -DRWDEBUG=1 -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/11s/lib -Bstatic -ltls11s -lstd11s -Bdynamic
> for release :
> CC -xildoff +w +p -fast -o Test_release.exe test.cc -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s -I/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/include -I. -L/opt/RogueWave/Summer-1999/workspaces/SOLARIS251/SUNPRO42/8s/lib -Bstatic -ltls8s -lstd8s -Bdynamic
> #Code
> #include <string>
> #include <fstream.h>
> #include <iostream.h>
> #include <rw/bench.h>
>
>
> class std_string_getline : public RWBench
> {
> public:
> std_string_getline() {;}
>
> void doLoop(unsigned long n);
> void idleLoop(unsigned long n);
> void what(ostream& os) const { os << "Standard String Getline : " << endl;}
> };
>
> class classic_getline : public RWBench
> {
> public:
> classic_getline() {;}
>
> void doLoop(unsigned long n);
> void idleLoop(unsigned long n);
> void what(ostream& os) const { os << "Classic Getline : " << endl;}
> };
>
> int
> main(int argc, char** argv)
> {
>
> std_string_getline test_std_string;
> test_std_string.parse(argc, argv);
> test_std_string.go();
> test_std_string.report(cout);
>
> classic_getline test_classic_getline;
> test_classic_getline.parse(argc, argv);
> test_classic_getline.go();
> test_classic_getline.report(cout);
> }
>
> void
> std_string_getline::doLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> string line;
> line.reserve(512);
>
> while (!(toRead.eof()))
> {
> getline(toRead, line, '\n');
> }
> }
> }
>
> void
> std_string_getline::idleLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> string line;
> line.reserve(512);
> }
> }
>
> void
> classic_getline::doLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> char cLine[512];
> string line;
> line.reserve(512);
>
> while (!(toRead.eof()))
> {
> toRead.getline(cLine, 512);
> line = cLine;
> }
> }
> }
>
> void
> classic_getline::idleLoop(unsigned long n)
> {
> while (n--)
> {
> ifstream toRead(__FILE__);
> char cLine[512];
> string line;
> line.reserve(512);
> }
> }
> #EndCode
> There appears to be something to this. I ran the program and here is the output:
> Sun C++
> Standard String Getline :
> Iterations: 1
> Inner loop operations: 1000
> Total operations: 1000
> Elapsed (user) time: 18.18
> Operations per second: 55.0055
> Sun C++
> Classic Getline :
> Iterations: 5
> Inner loop operations: 1000
> Total operations: 5000
> Elapsed (user) time: 4.67
> Kilo-operations per second: 1.07066
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.