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, 14 Jan 2000 14:18:49 -0500	[thread overview]
Message-ID: <cUvTpL7Mb1N@iadd.jivetech.com> (raw)
In-Reply-To: <vjsAAPhNfzhvHg8A@ltsun0.star.le.ac.uk>

Tim Goodwin wrote, replying to me, replying to him:
> > > 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?
> 
> You tell me.
> 
>     for (i in 0 1 2 3 4 5 6 7 8 9)
>     ...
>     for (m in 0 1 2 3 4 5 6 7 8 9)
>     @{ ~ 0 0 }
> 
> According to strace on my Linux box, each loop calls fork(), close(),
> rt_sigaction() twice, _exit(), and wait().

Fascinating.  My guess was definitely wrong.

> > > ([...]  Why does dynamic linking increase the user time?
> > The short answer is ``because dynamic
> > linking is done with user-space code.'')
> 
> Yeah: in crt0.  But (I'm sure) that isn't involved here.  I'd expect
> fork() to take more *system* time (since there are more MAP_SHARED page
> table entries to fiddle with), but I don't understand the increase in
> user time.

The only thing I can guess is that using the PIC version of the code in
the shared libraries and the shared library calling sequences is hurting
much more than I would have expected.  (Chapter 8 of Levine's book goes
into the issues here.)  My guess would have been at most a 10% hit, not
the 30% you're reporting.  Detailed profiling might shed more light.

--p


  reply	other threads:[~2000-01-14 20:32 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
2000-01-14 16:26     ` Tim Goodwin
2000-01-14 19:18       ` Paul Haahr [this message]
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=cUvTpL7Mb1N@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).