1 |
On 01/29/2012 02:14 PM, Mike Frysinger wrote: |
2 |
> On Saturday 28 January 2012 07:26:59 Anthony G. Basile wrote: |
3 |
>> I've run nbench on two amd64 systems both running the same kernel |
4 |
>> vanilla-3.2.2. |
5 |
> i don't think nbench is a good benchmark for this as it isn't really testing |
6 |
> what you think it's testing. it's very good at validating math support in the |
7 |
> ISA/ABI, optimized compiler output, and supplementary math implementations in |
8 |
> libgcc. PIE vs non-PIE will still be able to multiply/divide in pretty much |
9 |
> the same amount of time. |
10 |
|
11 |
I know, but the problem is, what benchmark best approximates common |
12 |
every day use? So I wrote the following which really hits the problem |
13 |
hard on x86: |
14 |
|
15 |
int modfac(int n) |
16 |
{ |
17 |
if(n==0) return 1; |
18 |
return n * modfac(n-1); |
19 |
} |
20 |
|
21 |
int main() |
22 |
{ |
23 |
int i; |
24 |
for( i = 0 ; i < 4096*4096 ; i++ ) modfac(4096); |
25 |
return 0; |
26 |
} |
27 |
|
28 |
Using vanilla kernel 3.2.2, userland built with vanilla toolchain, |
29 |
gcc-4.5.3-r1, glibc-2.13-r4, binutils-2.21.1-r1, compiling my code |
30 |
simply as gcc -o test modfac.c, CFLAGS="-O2 -march=i686 -pipe" I get: |
31 |
|
32 |
time -p ./test |
33 |
real 327.89 |
34 |
user 327.72 |
35 |
sys 0.00 |
36 |
|
37 |
Keep everything else the same, even the same hardware, but switch to |
38 |
userland built with hardened gcc-4.5.3-r2 (not -r1 because of the bus |
39 |
error), I get: |
40 |
|
41 |
time -p ./test |
42 |
real 629.68 |
43 |
user 629.37 |
44 |
sys 0.00 |
45 |
|
46 |
The hardware is 8 x "Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz" with 12 GB |
47 |
ram. That's nearly a factor of 2x but how often does one set up 4k |
48 |
stack frames in everyday use? |
49 |
|
50 |
>> So at least on amd64, I don't think that performance is ever an issue. |
51 |
> yes, most likely on systems where the PIC has hardware support in the ISA, the |
52 |
> performance hit on PIE is typically low. |
53 |
> |
54 |
>> I have yet to look at x86. |
55 |
> pretty sure this is going to be much more palpable. |
56 |
> -mike |
57 |
|
58 |
|
59 |
-- |
60 |
Anthony G. Basile, Ph.D. |
61 |
Gentoo Linux Developer [Hardened] |
62 |
E-Mail : blueness@g.o |
63 |
GnuPG FP : 8040 5A4D 8709 21B1 1A88 33CE 979C AF40 D045 5535 |
64 |
GnuPG ID : D0455535 |