This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Performance problems with ld
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Fritz Boehm <fritz at intrinsity dot com>
- Cc: bug-binutils at gnu dot org, binutils at sources dot redhat dot com
- Date: Sat, 5 Apr 2003 09:57:56 -0800
- Subject: Re: Performance problems with ld
- References: <20030405132114.GA11864@schrems.eng.intrinsity.com>
It seems similar to
http://sources.redhat.com/ml/bug-binutils/2002-q3/msg00440.html
I will see what I can do.
H.J.
---
On Sat, Apr 05, 2003 at 07:21:14AM -0600, Fritz Boehm wrote:
> Hey,
>
> I'm seeing a noticeable slow down with ld going from redhat 7.1 to redhat
> 8.0 when linking code compiled with debug as opposed to without debug.
>
> The version of gcc on 7.1 is:
> gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-94.Intrinsity)
>
> The version of gcc on 8.0 is:
> gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
>
> The version of ld on 7.1 is:
> GNU ld version 2.11.90.0.8 (with BFD 2.11.90.0.8)
>
> The version of ld on 8.0 is:
> GNU ld version 2.13.90.0.2 20020802
>
>
> Here is a log of commands executed on a 7.1 box:
>
> % g++ -c definitions_*.cpp
> % g++ -c main.cc
> % time g++ -o main main.o definitions*.o
> 3.530u 0.180s 0:39.21 9.4% 0+0k 0+0io 509pf+0w
>
> % g++ -c definitions_*.cpp -g
> % g++ -c main.cc -g
> % time g++ -o main main.o definitions*.o
> 5.880u 0.270s 0:48.13 12.7% 0+0k 0+0io 509pf+0w
>
>
> Here is a log of commands executed on a 8.0 box:
>
> % g++ -c main.cc
> % g++ -c definitions_*.cpp
> % time g++ -o main main.o definitions*.o
> 5.023u 0.572s 0:09.73 57.4% 0+0k 0+0io 481pf+0w
> % g++ -c definitions_*.cpp -g
> % g++ -c main.cc -g
> % time g++ -o main main.o definitions*.o
> 1875.166u 8.652s 41:57.00 74.8% 0+0k 0+0io 490pf+0w
>
> Just to be clear, there is no functional problem, just a performance problem.
> But the performance is so bad that we cannot use the tool in this way.
>
>
>
> In addition to seeing the linker slow with code compiled with debug on,
> we also see a large increase in linker time when the -export-dynamic switch
> is used. There seems to be a non-linear increase in time. Here is the same
> files, without debug, but with -export-dynamic used:
>
> % g++ -c definitions_*.cpp
> % g++ -c main.cc
> % time g++ -o main main.o definitions*.o -export-dynamic
> 25.255u 0.369s 0:33.69 76.0% 0+0k 0+0io 490pf+0w
>
>
> Again, this is purely a performance problem, not a function problem. With
> our actual code set, however, this causes a 1 minute link to take almost
> an hour, so we cannot use this feature, either.
>
> To duplicate my efforts, compile and execute this simple C program:
>
> /* start of simple c program */
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main()
> {
> FILE *OUT;
> for (int i = 0; i < 10; i++)
> {
> char szBuffer[80];
> sprintf(szBuffer,"definitions_%d.cpp", i);
> OUT = fopen(szBuffer,"w");
> if (OUT == NULL)
> {
> printf("couldn't open %s - exiting\n", szBuffer);
> exit(1);
> }
> for (int j = 0; j < 300000; j++)
> {
> fprintf(OUT,"int lFile%dInt%d;\n", i,j);
> }
> fclose(OUT);
> }
> }
>
> /* end of simple c program */
>
>
> This program will create the definitions_*.cpp files. You can use these
> together with this main.c:
>
>
> /* simple main.c */
> int main()
> {
> return 0;
> }
> /* end of simple main.c */
>
> I hope it is easier to just send the small c program along to generate the
> files instead of the 5 MB of definitions files.
>
> Please contact me at this email address if you have any questions or if I
> can be of any help to you:
>
> fritz at intrinsity dot com
>
> Sincerely,
> Fritz Boehm
> --
> **********************************************************************
> * Fritz Boehm Intrinsity, Inc. *
> * fritz at intrinsity dot com 11612 RM 2244 *
> * voice: (512) 421 - 2106 Building II Suite 200 *
> * fax: (512) 263 - 0795 Austin, Texas 78733 *
> **********************************************************************