[comp.archives] [folklore] Re: Optimizing for compile time?

danno@eleazar.dartmouth.edu (Danno) (02/22/91)

Archive-name: unix/programming/pikestyle/1991-02-19
Archive: cs.toronto.edu:/doc/programming/pikestyle.* [128.100.1.65]
Original-posting-by: danno@eleazar.dartmouth.edu (Danno)
Original-subject: Re: Optimizing for compile time?
Reposted-by: emv@ox.com (Edward Vielmetti)

atk@tigger.Colorado.EDU (Alan T. Krantz) writes:

>I think (hope) the thread about optimizing compile time is a joke. It
>has to be - honest. Who in their right mind, or for that matter, their
>wrong mind, would optimize for compile time?

Well, this isn't exactly ``optimizing'' for compilation, but it's
something of an example.  This comes from a collection of short
essays on programming style by Rob Pike, called ``Notes on
Programming in C.''  It is available from cs.toronto.edu via
anonymous FTP; this and other useful programming tips are in either
/pub/doc/programming, or some variation thereof.  To quote:

	``There's a little dance involving #ifdef's that can
	prevent a file being read twice, but it's usually done wrong
	in practice - the #ifdef's are in the file itself, not the
	file that includes it.  The result is often thousands of
	needless lines of code passing through the lexical analyzer,
	which is (in good compilers) the most expensive phase.''

He is talking here about #include files that #include other files
that you might have already included.

How much do you need to worry about this? It depends on how loaded
down the machine you're working on is: it might not matter if you
have a workstation at your desk, but a lot of us often work on
general-use UNIX machines that will have upwards of 30 users at a
time, doing any number of things.

A folklore question: What are good uses for lots and lots of spare
9-track write rings?  I've just become a junior operator, and these
things are proliferating at an alarming rate...

-- 
   Danno McKinnon    |            danno@eleazar.dartmouth.edu
---------------------+--------------------------------------------------
 Computer programmer |  ``Now get out of here, before someone drops 
  & data librarian   |   a house on you, too!'' -- Glinda of the North