Compiling libjvm.so as PIC
doko at ubuntu.com
Thu Dec 18 10:03:05 PST 2008
Andrew Haley schrieb:
> Omair Majid wrote:
>> Matthias Klose wrote:
>>> Omair Majid schrieb:
>>>> Ionana and I have been trying to get icedtea to work when built as a
>>>> normal user with SELinux enabled. SELinux stops java from loading
>>>> libjvm.so which is built as non-PIC. Please see
>>>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6538311 for more
>>>> The bug report states that building libjvm.so as PIC has performance
>>>> penalties. Ioana and I have been comparing the performance of a JVM
>>>> built as PIC with one built as non-PIC for the last few days. For the
>>>> JVM built as PIC, the fastest run was about 3% faster than the slowest.
>>>> For the JVM built as non-PIC, the fastest run was about 1% faster than
>>>> the slowest. Comparing the average performance, the PIC JVM seems to be
>>>> faster by 0.59% which indicates that any difference in performance is
>>>> Building libjmv.so as PIC should also result in memory savings as the
>>>> code segment will be shared across processes.
>>>> The attached patch will build libjvm.so as PIC. Any objections to
>>>> applying it?
>>> does it make a difference with SELinux disabled?
>> I just finished running the tests with SELinux disabled. The performance
>> difference between a PIC jvm and a non-PIC jvm was about 0.9%, with the
>> PIC jvm being actually faster. So any performance loss is negligible.
> Thanks. I suspect that the problem this non-PIC compile was supposed to fix
> may be a bit of ancient history based on an old version of gcc. It's not
> entirely surprising that PIC might be faster, since fixing up the non-PIC
> relocations takes extra time.
I don't share this point. The python interpreter, statically built with
gcc-4.2.x is about 10% faster than the version built with -fPIC. When built with
gcc-4.3.x it runs the pybench in pic/non-pic with the same speed as the
gcc-4.2.x build with pic. So with gcc-4.3.x it doesn't make a difference, while
it did with gcc-4.2.x. However I didn't explicitely check jvm builds. How were
the performance checks done?
More information about the distro-pkg-dev