This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libstdc++/9606: performance regression in operator<<(ostream&,int)

>Number:         9606
>Category:       libstdc++
>Synopsis:       performance regression in operator<<(ostream&,int)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 06 23:46:00 UTC 2003
>Originator:     Joe Buck
>Release:        gcc-3.2.1 (actually, all gcc-3.x releases)
Compile and run the test program below with
g++ -O3 prog.C -o prog

and time it.  For gcc 3.2.1 on a Xeon 2.2 GHz box,
it takes 17.39 sec, but for gcc 2.95.3, it takes
2.06 sec.

It seems that the difference is that snprintf is
now used.

// this is the test program.
#include <fstream>

int main(int argc, char** argv) {
    std::ofstream sink("/dev/null");
    for (int i = 0; i < 10000000; i++)
	sink << i;
    return 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]