Well, since apparently this list is not for sarcasms, I've done a simple
experiment. In each file F.c in squid/src/*.c, I have replaced
#include "squid.h"
with
#include "squid.h-F.c.h"
copying squid.h to squid.h-F.c.h along the way.
For example,
stat.c:#include "squid.h-stat.c.h"
stmem.c:#include "squid.h-stmem.c.h"
store.c:#include "squid.h-store.c.h"
So now each *.c file that used squid.h uses a uniquely named copy of
squid.h. The result:
2215082 Jan 12 19:39 squid
Then I decided that this is not bad enough and repeated the procedure
for all 7 local src/*.h files Squid is using:
wais.c:36:#include "squid.h-wais.c.h"
squid.h-wais.c.h:363:#include "defines.h-wais.c.h"
squid.h-wais.c.h:364:#include "enums.h-wais.c.h"
squid.h-wais.c.h:365:#include "typedefs.h-wais.c.h"
...
In other words, every src/*.c file now included (via squid.h-F.c.h) its own
copies of squid.h, defines.h, globals.h, etc. There were about 750 *.h files
total. The result:
2215082 Jan 12 20:10 squid
The stock squid was:
2215090 Jan 12 19:22 squid
Of course, the test above did not change the order of include files, but one
would expect that having 750 uniquely named files is the worst case scenario.
But I don't give up to get at least some optimization: I am now manually
truncating all variable/type names longer than 3 characters to their unique
4-character hash value. Perhaps that will help to find the balance between
"strip" and "gcc -g".
Alex.
P.S. Too bad my editor is so slow on `cat *.c > squid.c` file.
On Thu, 13 Jan 2000, David Luyer wrote:
> There is another advantage you didn't realise, or maybe did. Since squid is
> left compiled with debugging, the executable size is massively reduced by the
> single squid.h. gcc will basically share the debugging info if include files
> are included in the same order, but if they aren't then it won't, since some
> #defines etc being different due to the different order of the include files
> may have influenced the included files.
>
> For discussions on this see the wine-devel list archive, probably 6-12 months
> ago.
Received on Wed Jan 12 2000 - 20:35:45 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:20 MST