40% slowdown with dynamic /bin/sh
M. Warner Losh
imp at bsdimp.com
Mon Nov 24 22:16:45 PST 2003
> And I just did a "make clean" run in /usr/ports/archivers (by manually
> mv'ing a static and dynamic sh to /bin in turn):
>
> static: 96.63 real 53.45 user 39.27 sys
> dynamic: 112.42 real 55.51 user 51.62 sys
>
> The wall clock is bad (16% worse) and the system time is worse (31%).
So all the worstness is in system time, or nealy all. However, you
rant this test only once.
: >
: > So..
: >
: > 1) Microbenchmark: 40% worse
: > 2) Bootstone(*): 25% worse
: > 3) Ports: 16% worse
Hmmmm, It looks like the hit is less than 10% in the fork intensive
test I just wrote:
#!/bin/sh
for i in 0 1 2 3 4 5 6 7 8 9; do
for j in 0 1 2 3 4 5 6 7 8 9; do
for k in 0 1 2 3 4 5 6 7 8 9; do
for l in 0 1 2 3 4 5 6 7 8 9; do
for m in 0 1 2 3 4 5 6 7 8 9; do
for n in 0 1 2 3 4 5 6 7 8 9; do
true;
done; done; done; done; done; done;
Here's the numbers I got:
x sh-s static sh
+ sh-d dynamic sh
+--------------------------------------------------------------------------+
| x x + |
| x x + + |
| x x x x + + + |
| x x x x + + + + + + |
|x x x x x + + + + + + + +|
| |___A__M_| |________A__M____| |
+--------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 20 1.27 1.31 1.3 1.2925 0.012085224
+ 20 1.4 1.47 1.44 1.431 0.023597502
Difference at 95.0% confidence
0.1385 +/- 0.0119989
10.7157% +/- 0.928346%
(Student's t, pooled s = 0.0187469)
As you can see, I ran each of the tests 10 times. I timed it using a
the tcsh time built-in. I ran each command once before I started
timing the commands to reduce cache effects.
Clearly dynamic is slower, but it is more like 11% slower (10.67%) on
the average than 40% slower. I think this would be a more typical
usage pattern.
So things are a little bad, but it isn't the end of the world,
especially for a 5.2-beta that's going out.
Warner
More information about the freebsd-current
mailing list