public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Carlo Wood <carlo@runaway.xs4all.nl>
To: egcs@cygnus.com
Subject: No Subject
Date: Sun, 28 Feb 1999 22:53:00 -0000	[thread overview]
Message-ID: <9506.950506679.8@NO-ID-FOUND.mhonarc.org> (raw)

                                  added #pragma interface
   text    data     bss   total	  to header file:
 351515   10404    3920  365839   select.h
 351786   10404    3920  366110   iodbbuf_fd.h
 352362   10404    3920  366686   listen_sock.h
 352362   10404    3920  366686   listen_sock_dtct.h
 352426   10404    3920  366750    -
 353303   10436    3920  367659   sock.h
 354257   10464    3928  368649   events.h
 355505   10488    3940  369933   timing.h
 361015   11296    4048  376359   traits.h

Interesting is that the size *grows* 3% by *adding* a "#pragma interface"
just to traits.h :)...

The bad cases however are at the top: The cases in which adding
"#pragma interface" indeed makes the (text) size shrink.

I'd charaterize these "winners" as the ones that are included in the
most source files and/or contain functions that are used the most often.
There is no reason to assume they do something special, except being
used a lot.

"sys.h" for instance is #included in EVERY source file, before ANY
other header file is included (including system header files).

A test file with only '#include "libr/sys.h"' in it, compiled
with -E, and skipping all empty lines and comments gives:

==============================================================================
extern "C" { 
typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;
typedef unsigned long long int __u_quad_t;
typedef long long int __quad_t;
typedef __quad_t *__qaddr_t;
typedef __u_quad_t __dev_t;		 
typedef __u_int __uid_t;		 
typedef __u_int __gid_t;		 
typedef __u_long __ino_t;		 
typedef __u_int __mode_t;		 
typedef __u_int __nlink_t; 		 
typedef long int __off_t;		 
typedef __quad_t __loff_t;		 
typedef int __pid_t;			 
typedef int __ssize_t;			 
typedef struct
  {
    int __val[2];
  } __fsid_t;				 
typedef int __daddr_t;			 
typedef char *__caddr_t;
typedef long int __time_t;
typedef long int __swblk_t;		 
\f
typedef long int __clock_t;
typedef unsigned long int __fd_mask;
typedef struct
  {
    __fd_mask fds_bits[1024  / (8 * sizeof (__fd_mask)) ];
  } __fd_set;
typedef int __key_t;
typedef unsigned short int __ipc_pid_t;
typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;
typedef __dev_t dev_t;
typedef __gid_t gid_t;
typedef __ino_t ino_t;
typedef __mode_t mode_t;
typedef __nlink_t nlink_t;
typedef __off_t off_t;
typedef __loff_t loff_t;
typedef __pid_t pid_t;
typedef __uid_t uid_t;
typedef __ssize_t ssize_t;
typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;
typedef __key_t key_t;
typedef __time_t time_t;
typedef unsigned int size_t;
typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
typedef int int8_t __attribute__ ((__mode__ (  __QI__ ))) ;
typedef unsigned int u_int8_t __attribute__ ((__mode__ (  __QI__ ))) ;
typedef int int16_t __attribute__ ((__mode__ (  __HI__ ))) ;
typedef unsigned int u_int16_t __attribute__ ((__mode__ (  __HI__ ))) ;
typedef int int32_t __attribute__ ((__mode__ (  __SI__ ))) ;
typedef unsigned int u_int32_t __attribute__ ((__mode__ (  __SI__ ))) ;
typedef int int64_t __attribute__ ((__mode__ (  __DI__ ))) ;
typedef unsigned int u_int64_t __attribute__ ((__mode__ (  __DI__ ))) ;
typedef int register_t __attribute__ ((__mode__ (__word__)));
struct timespec
  {
    long int tv_sec;		 
    long int tv_nsec;		 
  };
extern "C" { 
struct timeval;
typedef __fd_mask fd_mask;
typedef __fd_set fd_set;
extern int __select  (int __nfds, __fd_set *__readfds,
			  __fd_set *__writefds, __fd_set *__exceptfds,
			  struct timeval *__timeout)  ;
extern int select  (int __nfds, __fd_set *__readfds,
			__fd_set *__writefds, __fd_set *__exceptfds,
			struct timeval *__timeout)  ;
extern int __pselect  (int __nfds, __fd_set *__readfds,
			   __fd_set *__writefds, __fd_set *__exceptfds,
			   struct timespec *__timeout)  ;
extern int pselect  (int __nfds, __fd_set *__readfds,
			 __fd_set *__writefds, __fd_set *__exceptfds,
			 struct timespec *__timeout)  ;
} 
} 
const unsigned int malloc_overhead_c = 0;
typedef int sa_handler_param_type;
static const char rcs_ident_sys_sys_h[] __attribute__ ((unused)) =   "$Id: sys.h,v 1.1.1.1 1998/06/17 16:02:19 carlo Exp $" ; 
==============================================================================

So, a clue could perhaps be that a `typedef' uses space in the text segment?
(In a duplicating way)

Note that all of these typedefs come from system header files that were
included from sys.h.  It surprices me that "#pragma interface" seems to
have influence in this case.  Perhaps I should start to include all my
system headers from own headers, so I can add a "#pragma interface" in
front of it (the system headers do not contain a "#pragma interface" by
themselfs).

If I can provide any other info, please let me know.
Hopefully things get easier once I can release libr (I am waiting for
Qt-2.0 to be released because I want to use its QPL).

After adding "#pragma interface" only in those header files where it
makes the text segment shrink, I could get it as small as:

   text    data     bss     dec     hex filename
 329351    9680    3780  342811   53b1b ../../lib/libr.so.0.2.5

which is 10% smaller than the worsed case...

Regard,

 Carlo Wood  <carlo@runaway.xs4all.nl>

             reply	other threads:[~1999-02-28 22:53 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-28 22:53 Carlo Wood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-01-05 13:44 Re: No subject Peter0x44
2024-01-05 16:59 ` LIU Hao
2024-01-05 17:05   ` Peter0x44
2009-12-29 19:40 no subject gcc
     [not found] <20040331044106.GA3560@twcny.rr.com>
2004-03-31  8:46 ` No Subject Jim Wilson
2004-04-01  8:29   ` Nathanael Nerode
1999-04-30 23:15 
1999-04-30 23:15 
1999-04-30 23:15 
1999-04-30 23:15 
1999-04-30 23:15 
1999-04-30 23:15 
1999-04-30 23:15 
1999-04-24 22:26 Jeffrey A Law
1999-04-30 23:15 ` Jeffrey A Law
1999-03-31 23:46 
1999-03-31 23:46 
1999-03-31 23:46 Gerald Pfeifer
1999-03-31 23:46 
1999-03-31 23:46 
1999-03-24  8:47 Leonardo Marques de Souza
1999-03-31 23:46 ` Leonardo Marques de Souza
1999-02-28 22:53 
1999-02-28 22:53 
1999-02-28 22:53 John White
1999-02-28 22:53 
1999-02-28 22:53 Nathan Sidwell
1999-02-28 22:53 
1999-02-28 22:53 Jörn Rennecke
1999-02-28 22:53 
1999-02-28 22:53 
1999-02-02 16:11 killer
1999-02-28 22:53 ` killer
1999-01-29  6:41 Gerald Pfeifer
1998-12-17  8:43 NO SUBJECT Geert Bosch
1998-12-18 12:03 ` Dave Love
1998-12-17  8:32 tprince
1998-11-03 21:28 No Subject root
     [not found] <informant@earthlink.net>
1998-10-29  6:59 ` informant
1998-10-11 23:39 David
1998-10-04 18:52 John Breen
1998-10-03  8:00 David S. Miller
1998-09-26 15:59 John Breen
1998-09-25  8:01 John Breen
1998-09-23 12:43 John Breen
1998-09-18 21:46 David S. Miller
1998-09-18 17:29 David S. Miller
1998-09-18 22:10 ` Mark Mitchell
1998-09-18 22:10   ` David Edelsohn
1998-09-15  7:06 John Breen
1998-09-14 14:04 John Breen
1998-09-14 11:13 John Breen
1998-09-09 11:23 John Breen
1998-07-25  9:14 Vin Shelton
1998-07-10  8:14 Massimo CICCOTELLI
1998-07-10  6:04 Jonathan Williams
1998-06-30 14:46 Eric Sebastian Pogrelis
1998-06-25 15:59 system PRIVILEGED account
1998-06-10  4:03 m. capel
1998-06-03  0:17 65tr3w
1998-05-29 21:32 4n4b2ds
1998-05-23 22:47 Jeffrey A Law
1998-05-18  8:51 Richard Earnshaw
1998-05-16 10:14 Richard Earnshaw
1998-05-02 17:39 Steven Jones
1998-05-01 21:25 Peter  Garner
1998-05-01 21:25 Peter  Garner
1998-04-08  2:13 Yuan Xie
1998-04-05 21:29 Doug Semler
1998-04-06 17:35 ` David Edelsohn
1998-03-27 15:18 Ken Faiczak
1998-03-16 20:25 Oskar Enoksson
1998-03-10  7:16 Bruno Haible
1998-02-12 19:36 Satoshi HONDA
1998-02-10  3:34 Jeffrey A Law
1998-02-09 14:46 Jochen Kuepper
1998-02-09  3:22 Thomas Aigner
1998-01-08  6:05 Andrew Zabolotny
1997-12-08  9:35 ManfredMetzger
1997-12-05 13:11 Thomas Weise
1997-12-03  0:21 System Source
1997-10-23 13:54 Aaron Jackson
1997-10-07 11:41 Max Lawson
1997-09-26 20:48 Jeffrey A Law
1997-09-11 10:36 Marc David Rovner
1997-09-11 10:36 God
1997-09-06  9:41 Nick Burrett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9506.950506679.8@NO-ID-FOUND.mhonarc.org \
    --to=carlo@runaway.xs4all.nl \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).