[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Performance problems with ld
From: |
Fritz Boehm |
Subject: |
Performance problems with ld |
Date: |
Sat, 5 Apr 2003 07:21:14 -0600 |
User-agent: |
Mutt/1.4i |
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:
address@hidden
Sincerely,
Fritz Boehm
--
**********************************************************************
* Fritz Boehm Intrinsity, Inc. *
* address@hidden 11612 RM 2244 *
* voice: (512) 421 - 2106 Building II Suite 200 *
* fax: (512) 263 - 0795 Austin, Texas 78733 *
**********************************************************************
- Performance problems with ld,
Fritz Boehm <=