Opened 10 years ago

Closed 10 years ago

#4716 closed bug (invalid)

major performance problem with gcc2 version of STL

Reported by: augiedoggie Owned by: nobody
Priority: normal Milestone: R1
Component: - General Version: R1/alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

There seems to be a problem with the gcc2 version of std::ostringstream. In certain cases the gcc2 version is up to 300 times slower than with gcc4. I'm attaching some sample code which demonstrates the problem.

Attachments (1)

streamtest.cpp (328 bytes ) - added by augiedoggie 10 years ago.

Download all attachments as: .zip

Change History (4)

by augiedoggie, 10 years ago

Attachment: streamtest.cpp added

comment:1 by augiedoggie, 10 years ago

Apparently this is a known problem with many versions of the stl. The problem is that ostringstream only increases the buffer by a very small amount at a time(1 char?) which causes a lot of allocations and memory copies.

The problem code with our headers is at: http://dev.haiku-os.org/browser/buildtools/trunk/legacy/gcc/libstdc++/sstream#L109

The line that reads:

stream_len += 1;

should probably be replaced by something which examines the length of the incoming buffer similar to what the gcc4 version does.

comment:2 by augiedoggie, 10 years ago

This ticket can be closed. After combing through many bug reports on the subject it seems the only solution was to replace libstdc++ with a newer version which would probably break binary compatibility for us.

comment:3 by anevilyak, 10 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.