Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Oct 2019 16:34:14 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Alexey Dokuchaev <danfe@FreeBSD.org>
Cc:        Enji Cooper <yaneurabeya@gmail.com>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r353937 - in head/share: man/man5 mk
Message-ID:  <67F6BDD3-B633-4C85-AE85-9B075FF0E49E@FreeBSD.org>
In-Reply-To: <20191024124910.GA93913@FreeBSD.org>
References:  <201910231702.x9NH2jQv045130@repo.freebsd.org> <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> <20191024124910.GA93913@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii



> On 24 Oct 2019, at 14:49, Alexey Dokuchaev <danfe@FreeBSD.org> wrote:
> 
> On Wed, Oct 23, 2019 at 11:31:41AM -0700, Enji Cooper wrote:
>>> On Oct 23, 2019, at 10:02, Dimitry Andric <dim@freebsd.org> wrote:
>>> New Revision: 353937
>>> URL: https://svnweb.freebsd.org/changeset/base/353937
>>> 
>>> Log:
>>> Build toolchain components as dynamically linked executables by default
> 
> What are the benefits of the new order?

The advantages and disadvantages of dynamic linking are a contentious
and almost religious issue, so I hope you don't mind that I will not go
into this.


>>> In this day and age, we have boot environments, virtual machine
>>> snapshots, cloud backups, and other much more reliable methods to
>>> restore systems to working order.  So I think the time is ripe to flip
> 
> What about those of us who cannot use BEs, VMs, and other "cloudy" tech
> because, well, they might not work as well and reliably as one might think?

There are many possibilities, such as making backups, using
WITHOUT_SHARED_TOOLCHAIN (and hoping that you can compile/link your way
out of a botched installation), or even using NO_SHARED.


>> Using dynamic binaries instead of static binaries might actually regress
>> performance in a way you don't expect, depending on -j values, etc. Static
>> binaries avoid the dynamic linker, which (obviously) results in a perf hit
>> at scale [...]
> 
> Very good point.

But if you take this point to its logical conclusion, then you should
link everything statically, and never use dynamic linking at all. :)


>> Did you calculate the perf trade offs for the static binaries at low -j vs
>> high -j, system and user time, etc?
> 
> I'd like to know the answer to this question (and the results) as well.

I only tested -j24 on a 32-core system, but I could probably repeat the
experiment with lower and higher -j values:

* host system (and dynamic linker): head r346082 (2019-04-10)
* base/head checkout at r354065
* clang and lld compiled from r354065, dynamically linked:

      text    data       bss        dec         hex   filename
  69007497   52320    290469   69350286   0x422338e   bin-dynamic/cc
  45708182   35280    320613   46064075   0x2bee1cb   bin-dynamic/ld

* clang and lld compiled from r354065, statically linked:

      text    data       bss        dec         hex   filename
  70828318   71656   2592977   73492951   0x46169d7   bin-static/cc
  47533406   54776   2623121   50211303   0x2fe29e7   bin-static/ld

* built world with __MAKE_CONF and SRCCONF set to /dev/null, and CC,
  CXX, CPP and LD set to point to either the dynamic or static binaries
* verified that the cross-tools stage did /not/ attempt to bootstrap the
  compiler and linker
* repeated experiment 7 times, for each case
* measured real, user and system time of each experiment

Results for real time:
---------------------------------------------------------------------------
x static-real.txt
+ dynamic-real.txt
    N           Min           Max        Median           Avg        Stddev
x   7       1851.71       1892.11       1868.79     1868.6829     13.569253
+   7       1882.95       1940.74        1912.9     1912.6886     17.510156
Difference at 95.0% confidence
        44.0057 +/- 18.2444
        2.35491% +/- 0.985013%
        (Student's t, pooled s = 15.6641)

Results for user time:
---------------------------------------------------------------------------
x static-user.txt
+ dynamic-user.txt
    N           Min           Max        Median           Avg        Stddev
x   7      31734.75      32055.47      31983.16     31942.131      118.2333
+   7         32957       33282.1      33224.25     33150.727     137.84805
Difference at 95.0% confidence
        1208.6 +/- 149.569
        3.7837% +/- 0.47584%
        (Student's t, pooled s = 128.416)

Results for user time:
---------------------------------------------------------------------------
x static-sys.txt
+ dynamic-sys.txt
    N           Min           Max        Median           Avg        Stddev
x   7       2434.98       2661.22       2461.95     2516.3843     100.88134
+   7       2545.07        2813.8       2655.65     2682.5243     116.80319
Difference at 95.0% confidence
        166.14 +/- 127.11
        6.60233% +/- 5.1964%
        (Student's t, pooled s = 109.133)

So ~2.3% difference in real time, which is not too bad I think.  There
are probably opportunities to improve the performance of the dynamic
linker, which would be beneficial to every program in the system.

-Dimitry


--Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.2

iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXbRZZgAKCRCwXqMKLiCW
o2BUAJ9ndlMld+F7K83SDJeJ3Y6G78mkKgCfYUfcFVxZsFLdl9uvFwvYmCRVuN8=
=ER9l
-----END PGP SIGNATURE-----

--Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?67F6BDD3-B633-4C85-AE85-9B075FF0E49E>