public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/10672: Binary IO with fstream is slow in 3.2+ compared to gcc 2.96
@ 2003-05-08  0:46 daniel.lemire
  0 siblings, 0 replies; 2+ messages in thread
From: daniel.lemire @ 2003-05-08  0:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10672
>Category:       libstdc++
>Synopsis:       Binary IO with fstream is slow in 3.2+ compared to gcc 2.96
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 08 00:45:59 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     daniel.lemire@nrc.gc.ca
>Release:        gcc version 3.4 20030507 (experimental) +  gcc version 3.2.3
>Organization:
>Environment:
linux 2.4.18-3 (RedHat 7.3) on 686
>Description:
fstream in 3.x series is extremely slow for binary
files compared to pre-3.x.

latest CVS (20030507)

real    0m4.773s
user    0m1.680s
sys     0m3.010s

3.2.3 (release)

real    0m5.503s
user    0m2.710s
sys     0m2.790s


gcc 2.96 (Clearly better)

real    0m2.920s
user    0m1.090s
sys     0m1.830s


Of course, this was one trial on the same machine.

I have more complex software here where the drop in 
speed is as high as 5 times. This is a show stopper
for me.

(This is related to bug 8761 but this bug is specific
to binary files and thus doesn't involve formatting
issues.)
>How-To-Repeat:
given the file test.cpp below
===================
#include <fstream>
using namespace std;

int main() {
		fstream s("test.bin",ios::binary | ios::in | ios::out);
		for (int i = 0; i < 300000;i++) {
			s.seekp(0);
			s.write((char *) & i, sizeof(int));
			s.seekp(sizeof(int));
			s.write((char *) & i, sizeof(int));
		}
		return 0;
}
===============
do

g++ -o a.out test.cpp -O2

followed by

time ./a.out

>Fix:
Revert back to gcc 2.96.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: libstdc++/10672: Binary IO with fstream is slow in 3.2+ compared to gcc 2.96
@ 2003-05-18  8:26 paolo
  0 siblings, 0 replies; 2+ messages in thread
From: paolo @ 2003-05-18  8:26 UTC (permalink / raw)
  To: daniel.lemire, gcc-bugs, gcc-prs, nobody

Synopsis: Binary IO with fstream is slow in 3.2+ compared to gcc 2.96

State-Changed-From-To: open->feedback
State-Changed-By: paolo
State-Changed-When: Sun May 18 08:25:00 2003
State-Changed-Why:
    This is already fixed in mainline (future 3.4).
    On my P4-2400, 10^6 iterations, 5 consecutive runs:
    2.96-99 (NB: *not* an official FSF release):
    -------
    2.630u 4.970s 0:07.64 99.4%     0+0k 0+0io 136pf+0w
    2.660u 4.930s 0:07.62 99.6%     0+0k 0+0io 136pf+0w
    2.790u 5.120s 0:07.97 99.2%     0+0k 0+0io 136pf+0w
    2.720u 4.840s 0:07.59 99.6%     0+0k 0+0io 136pf+0w
    2.830u 4.670s 0:07.54 99.4%     0+0k 0+0io 136pf+0w
    
    3.4 20030516
    ------------
    2.500u 4.790s 0:07.34 99.3%     0+0k 0+0io 217pf+0w
    2.570u 4.690s 0:07.31 99.3%     0+0k 0+0io 217pf+0w
    2.350u 4.990s 0:07.38 99.4%     0+0k 0+0io 217pf+0w
    2.650u 4.670s 0:07.38 99.1%     0+0k 0+0io 217pf+0w
    2.590u 4.720s 0:07.35 99.4%     0+0k 0+0io 217pf+0w
    
    Could you please provide one of those nasty testcases
    which were showing a 5x performance regression?
    
    Thanks for your report, Paolo.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10672


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-18  8:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-08  0:46 libstdc++/10672: Binary IO with fstream is slow in 3.2+ compared to gcc 2.96 daniel.lemire
2003-05-18  8:26 paolo

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).