Doug Tody, Chief Programmer for our Image Reduction and Analysis Facility 
(IRAF) project, has optimized the 4.3BSD ld program to improve its
performance when it is used to link programs against large libraries.  Doug's
notes on the modification follow:

  The main change was to read the entire symbol table of each object
  module in all at once rather than a symbol at a time, which would
  result in tens of thousands of calls to the mget function when linking
  against large libraries.  Since there are now far fewer calls to the
  mget function, and the average call returns quite a bit more data, I
  also rewrote mget to use bcopy (movc3 on a vax) rather than a char loop
  to copy the data out to the user buffer.  When possible, large object
  libraries should also be reordered in topological order (e.g., with the
  reorder cshell script provided) to minimize disk seeks and maximize
  hits on the buffer cache.  In our case, where we commonly link against
  several very large libraries, these changes cut the wallclock link time
  nearly in half, and reduced the cpu time consumed by ld by 15-30
  percent.

Another change to ld incorporated in the attached patch file is the addition
of a Y flag which will cause information about symbols to be printed during
relocation.  This option can occasionally come in handy when debugging.

Steve Grandi, National Optical Astronomy Observatories, Tucson, AZ, 602-325-9228
UUCP: {arizona,decvax,hao,ihnp4,seismo}!noao!grandi   Internet: grandi@noao.arpa
SPAN/HEPNET: 5356::GRANDI or DRACO::GRANDI
