Re: /bin/bash vs. /bin/sh

Randy Chapman (
Tue, 19 Sep 1995 15:56:21 -0700 (PDT)

On Tue, 19 Sep 1995, Todd Fries wrote:

> > > > [108K stripped-down pdksh]
> > >
> > > My personal experience has varied greatly from this. I simply compiled bash
> > > shaired, and now I have a 6k executable with a 370k shaired library.
> > > Very acceptable, imho...
> >
> > Er, how is this an improvement over a 376k executable? I guess maybe
> > the shared library will stay resident, but so will the binary itself.
> >
> > Also, it will run marginally slower that way. Not that this matters
> > much (most shell script overhead is from fork and exec)..

I should point out that Dhyrstones compiled as ELF shared lib take an almost
20% speed loss.... It seems to me that nothing truly CPU intensive should
really go into a shared library...

> > It is, and it should be.
> Well, either a) I'm halucinating or b) there is a use in having a 6k executable.
> If I run 12 copies of bash, 301k (static size for me) * 6 = 1806k executable in ram
> 6k (dynamic size) * 6 = 18k executable in ram

You're halucinating. Two instances of the program will share the program
code (at least, they had dang well better do so. Heck, even Windows has
done that since version 1).

> I know I neglected data space, but that should be the same for all and not an issue.
> Oh, I forgot. 18k(executable)+370k(dynamic lib)=388k....and 1806k-388k=1418k savings.

Either case should actually take up an almost identical amount of space.
ASsuming, of course, that oyu didnt compile the static with -N, in which
case nothing of the sort is true.

> I know it is marginally slower to load an executable and link it with a library. But
> you're telling me it is faster to load 301k than to load 6k and link it with a library?

YOu shouldnt ever load the entire executable, anyways. Parts will get loaded
as they are used. This becomes real obvious if you have power management
turned on and your hard disk has shutdown.

> I'm talking what I know; I realize I have no numbers to backup what I say.
> Would someone please verify this since I have no clue how to determine size usages
> of executables, nor load time and link time?

Investigate ps -mx for memory telling

> In my experience, X went from a swapp-happy almost-unusable beast to a silent hard drive
> when I change from 301k bash and 70k rxvt to 6k bash and 3k imho shaired is
> better....this is with a 386sx25 8mb ram...svga @ 1152x900x256...

That is odd. Make sure your bash and rxvt's were not compiled wrong.


> --
> Todd