rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: Paul Haahr <haahr@jivetech.com>
To: Tim Goodwin <tjg@star.le.ac.uk>
Cc: rc@hawkwind.utcs.toronto.edu
Subject: Re: Dynamically loading readline on demand (was Re: rc futures)
Date: Fri, 31 Dec 1999 19:22:08 -0500	[thread overview]
Message-ID: <cUtYiM7MbD@iadd.jivetech.com> (raw)
In-Reply-To: <ezkAAOYxczhcXQwA@ltsun0.star.le.ac.uk>

Tim Goodwin wrote
> I took an rc script that does nothing (makes no system calls) except
> fork() and wait() 10000 times.

Are you sure it doesn't exec at all?  Most of the costs associated with
dynamic loading would correspond with execs.  My comments below work on
the assumption that an exec of rc is included in your timing tests.  If
it wasn't, I'd be curious to see your script.

> Here are the results I got on my 200MHz Linux PC (us = microseconds).
> 
>     rc.static      744us
>     rc.rl.static   865us
>     rc.dynamic    1071us
>     rc.rl.dynamic 1442us

I guess it depends on what your test measures.  A ~30% performance
penaly doesn't seem like that much if it's saving enough by sharing the
library with other clients.

> ([...]  Why does dynamic linking increase the user time?  I have no
> idea, but it reliably does on both these platforms.)

(If you really care, see John Levine's excellent _Linkers and Loaders_
book, especially chapters 9 and 10.  Available at

  http://www.amazon.com/exec/obidos/ASIN/1558604960/paulhaahrA

and finer tech bookstores.  The short answer is ``because dynamic
linking is done with user-space code.'')

> My conclusion from this is that using readline is an insignificant
> (although measurable) performance hit.  But dynamic linking is always
> a bad idea.

No.  Dynamic linking slows startup time down with the gain of using
less memory overall.  It also makes systems more flexible, allowing the
upgrade of library code without explicit relinking of applications,
which is a big win.

> I therefore intend to drop my suggestion that rc should itself load
> readline on demand, and instead to make the following minor changes
> for rc-1.6b3.
> 
> 1. Modify the INSTALL documentation; we should always recommend linking
> statically.
> 
> 2. Modify configure.in, so that, if we are using gcc, `-static' is
> specified.

I disagree.  Overall system resource consumption still goes down with
dynamic linking and loading.  If a system is set up to use dynamic
linking by default, why should rc override that?

A number of us argued squarely against dynamic linking in the early '90s,
at least partially because dynamic linking encouraged software bloat.
The bloatists won because techniques like dynamic linking (along with
Moore's law) made the costs of bloat minimal.  (And, when it comes down
to it, bloat in libraries is probably a good thing.)

--p


  reply	other threads:[~2000-01-12 21:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-15 16:32 rc futures Russ Cox
2000-01-05 11:59 ` Dynamically loading readline on demand (was Re: rc futures) Tim Goodwin
2000-01-01  0:22   ` Paul Haahr [this message]
2000-01-14 16:26     ` Tim Goodwin
2000-01-14 19:18       ` Paul Haahr
2000-01-13  0:19   ` Jeremy Fitzhardinge
2000-01-07 10:38 Bengt Kleberg
2000-01-14 11:11 Bengt Kleberg

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=cUtYiM7MbD@iadd.jivetech.com \
    --to=haahr@jivetech.com \
    --cc=rc@hawkwind.utcs.toronto.edu \
    --cc=tjg@star.le.ac.uk \
    /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 NNTP newsgroup(s).