9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] impact of dynamic libraries on the speed of fork()
Date: Fri, 20 Feb 2009 15:19:01 -0500	[thread overview]
Message-ID: <c039c6cf5f581e6e6f15b345768ca27a@quanstro.net> (raw)
In-Reply-To: <20090220193401.KHHY16134.fed1rmmtao104.cox.net@fed1rmimpo03.cox.net>

On Fri Feb 20 14:35:45 EST 2009, cmbrannon@cox.net wrote:
> I wrote a really simple program, forktest.c.
> Next, I performed some experiments using this program.  Fork is faster
> for statically linked executables.  It becomes slower as more libraries
> are added to a dynamically linked executable.
> These tests were done on an x86 machine running Linux.
> Here is a transcript of my experiments, followed by the source for forktest.
>
> -- Chris

very nice.

i wonder if you may be measuring the performance
of memory management more than the performance of dynamic
linking.  the reason i suspect this is because on my p3 machine i see

gcc static	13440 f/s
gcc dyn	12953 f/s
gcc static 6963 fork + exec/s

or the tipoff is the size of the executable:

; ls -l a.out
-rwxr-xr-x 1 quanstro users 609298 Feb 20 14:36 a.out

for snarky comparison, here are the programs on my system that
are that large or larger:
--rwxrwxr-x M 48625 sys      sys    13275174 Jan 16  2006 /bin/gs
--rwxrwxr-x M 48625 sys      sys      758520 Dec  9  2005 /bin/spin

the hard bit would be keeping the memory footprint the
same while increasing the number of shared libraries.

even in bad cases, this is like 0.2ms/fork + exec.
i wonder if the reason that there can be such big
differences is that linux fork+exec may have been
massaged for such syntetic benchmarks.  thus small
amounts of extra work might look big.

- erik



  parent reply	other threads:[~2009-02-20 20:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 19:35 Chris Brannon
2009-02-20 19:54 ` Brian L. Stuart
2009-02-20 20:19 ` erik quanstrom [this message]
2009-02-20 20:36 ` Micah Stetson

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=c039c6cf5f581e6e6f15b345768ca27a@quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /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).