public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/4960: std::string slow to append individual characters
@ 2001-12-05 0:40 paolo
0 siblings, 0 replies; 7+ messages in thread
From: paolo @ 2001-12-05 0:40 UTC (permalink / raw)
To: gcc-bugs, gcc-gnats, gcc-prs, martin, nobody
Synopsis: std::string slow to append individual characters
State-Changed-From-To: analyzed->feedback
State-Changed-By: paolo
State-Changed-When: Wed Dec 5 00:40:47 2001
State-Changed-Why:
Fetch a current 3.1 snapshot and benchmark again. You
should notice a definite improvement.
However, the final solution to the problem is an
exponential growth policy. Patch for this posted in:
http://gcc.gnu.org/ml/libstdc++/2001-12/msg00007.html
Can you try it?
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4960&database=gcc
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/4960: std::string slow to append individual characters
@ 2001-12-08 1:56 paolo
0 siblings, 0 replies; 7+ messages in thread
From: paolo @ 2001-12-08 1:56 UTC (permalink / raw)
To: paolo; +Cc: gcc-prs
The following reply was made to PR libstdc++/4960; it has been noted by GNATS.
From: paolo@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
martin@v.loewis.de, nobody@gcc.gnu.org, paolo@gcc.gnu.org
Cc:
Subject: Re: libstdc++/4960: std::string slow to append individual characters
Date: 8 Dec 2001 09:52:46 -0000
Synopsis: std::string slow to append individual characters
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Sat Dec 8 01:52:46 2001
Responsible-Changed-Why:
Taking care of it.
State-Changed-From-To: feedback->closed
State-Changed-By: paolo
State-Changed-When: Sat Dec 8 01:52:46 2001
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4960&database=gcc
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/4960: std::string slow to append individual characters
@ 2001-12-08 1:52 paolo
0 siblings, 0 replies; 7+ messages in thread
From: paolo @ 2001-12-08 1:52 UTC (permalink / raw)
To: gcc-bugs, gcc-gnats, gcc-prs, martin, nobody, paolo
Synopsis: std::string slow to append individual characters
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Sat Dec 8 01:52:46 2001
Responsible-Changed-Why:
Taking care of it.
State-Changed-From-To: feedback->closed
State-Changed-By: paolo
State-Changed-When: Sat Dec 8 01:52:46 2001
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4960&database=gcc
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/4960: std::string slow to append individual characters
@ 2001-12-05 0:46 paolo
0 siblings, 0 replies; 7+ messages in thread
From: paolo @ 2001-12-05 0:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/4960; it has been noted by GNATS.
From: paolo@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
martin@v.loewis.de, nobody@gcc.gnu.org
Cc:
Subject: Re: libstdc++/4960: std::string slow to append individual characters
Date: 5 Dec 2001 08:40:47 -0000
Synopsis: std::string slow to append individual characters
State-Changed-From-To: analyzed->feedback
State-Changed-By: paolo
State-Changed-When: Wed Dec 5 00:40:47 2001
State-Changed-Why:
Fetch a current 3.1 snapshot and benchmark again. You
should notice a definite improvement.
However, the final solution to the problem is an
exponential growth policy. Patch for this posted in:
http://gcc.gnu.org/ml/libstdc++/2001-12/msg00007.html
Can you try it?
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4960&database=gcc
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/4960: std::string slow to append individual characters
@ 2001-11-21 14:36 pme
0 siblings, 0 replies; 7+ messages in thread
From: pme @ 2001-11-21 14:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/4960; it has been noted by GNATS.
From: pme@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
martin@v.loewis.de, nobody@gcc.gnu.org
Cc:
Subject: Re: libstdc++/4960: std::string slow to append individual characters
Date: 27 Nov 2001 23:33:03 -0000
Synopsis: std::string slow to append individual characters
State-Changed-From-To: open->analyzed
State-Changed-By: pme
State-Changed-When: Tue Nov 27 15:33:02 2001
State-Changed-Why:
This exact topic has been under discussion on the
libstdc++-v3 mailing list during the last 48 hours (and
for quite a while before then, too). Please check the
archives and try out the patches under consideration;
they will be included in some form or another in 3.1
(and possibly 3.0.x also).
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4960&database=gcc
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/4960: std::string slow to append individual characters
@ 2001-11-21 13:16 pme
0 siblings, 0 replies; 7+ messages in thread
From: pme @ 2001-11-21 13:16 UTC (permalink / raw)
To: gcc-bugs, gcc-gnats, gcc-prs, martin, nobody
Synopsis: std::string slow to append individual characters
State-Changed-From-To: open->analyzed
State-Changed-By: pme
State-Changed-When: Tue Nov 27 15:33:02 2001
State-Changed-Why:
This exact topic has been under discussion on the
libstdc++-v3 mailing list during the last 48 hours (and
for quite a while before then, too). Please check the
archives and try out the patches under consideration;
they will be included in some form or another in 3.1
(and possibly 3.0.x also).
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4960&database=gcc
^ permalink raw reply [flat|nested] 7+ messages in thread
* libstdc++/4960: std::string slow to append individual characters
@ 2001-11-21 12:36 martin
0 siblings, 0 replies; 7+ messages in thread
From: martin @ 2001-11-21 12:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 4960
>Category: libstdc++
>Synopsis: std::string slow to append individual characters
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Tue Nov 27 15:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Martin v. Loewis
>Release: 3.1 20010813 (experimental)
>Organization:
HUB
>Environment:
System: Linux mira 2.4.10-4GB #1 Tue Sep 25 12:33:54 GMT 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /usr/src/egcs/configure --prefix=/usr/local/newabi --enable-shared --enable-threads --enable-languages=c,c++,java
>Description:
In gcc 2.95, adding one character after another to an std::string resulted in infrequent
memory allocations, as the implementation would reserve sufficient memory. In libstdc++ v3,
each append invocation will cause reallocation (and copying of the existing string) once
the reserve is exhausted.
>How-To-Repeat:
Compile and benchmark the following program with both gcc 2.95 and gcc 3 on the same machine.
On a 900MHz Pentium III, the 2.95 compilation result needs 0.01s, the gcc 3 result needs 4.0s.
#include <string>
#include <stdio.h>
int main()
{
std::string s;
int i;
for(i=0;i<100000;i++){
//printf("%d %d\n",i,s.capacity());
s+=" ";
}
}
>Fix:
Add a reserve larger than the current size in std::string::append.
The strategy of libstdc++ 2 (using the nearest power of 2) seems reasonable.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-12-08 9:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-05 0:40 libstdc++/4960: std::string slow to append individual characters paolo
-- strict thread matches above, loose matches on Subject: below --
2001-12-08 1:56 paolo
2001-12-08 1:52 paolo
2001-12-05 0:46 paolo
2001-11-21 14:36 pme
2001-11-21 13:16 pme
2001-11-21 12:36 martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).