Guys, what do you think about defaulting the build to use -prefer-non-pic
and having libtool build a non-pic libphp4.so when building the Apache
DSO? That library isn't linked into other programs anyway, and Apache's
fork+exec model ensures the pages will be shared regardless of pic. I
don't really see what we gain by building it pic, and we certainly lose
quite a bit by doing so. In the order of 15-20% execution time on both
FreeBSD and Linux with gcc in my tests.
-Rasmus
Guys, what do you think about defaulting the build to use -prefer-non-pic
and having libtool build a non-pic libphp4.so when building the Apache
DSO? That library isn't linked into other programs anyway, and Apache's
fork+exec model ensures the pages will be shared regardless of pic. I
don't really see what we gain by building it pic, and we certainly lose
quite a bit by doing so. In the order of 15-20% execution time on both
FreeBSD and Linux with gcc in my tests.
I think this is a good idea, I've been manually doing the same thing on my
servers by compiling cli & apache separately. Performance wise in my
experience no-pic code is 25-30% faster on Linux. So far it worked perfectly
and I had not experienced any problems. I see no reason why we cannot offer
all PHP users the same performance advantages.
Ilia
Not all dls support non-PIC code in DSOs. If you know that
your system handles it fine, just pass the right -pic flag to
configure.
- Sascha
Guys, what do you think about defaulting the build to use -prefer-non-pic
and having libtool build a non-pic libphp4.so when building the Apache
DSO? That library isn't linked into other programs anyway, and Apache's
fork+exec model ensures the pages will be shared regardless of pic. I
don't really see what we gain by building it pic, and we certainly lose
quite a bit by doing so. In the order of 15-20% execution time on both
FreeBSD and Linux with gcc in my tests.I think this is a good idea, I've been manually doing the same thing on my
servers by compiling cli & apache separately. Performance wise in my
experience no-pic code is 25-30% faster on Linux. So far it worked perfectly
and I had not experienced any problems. I see no reason why we cannot offer
all PHP users the same performance advantages.Ilia
Not all dls support non-PIC code in DSOs. If you know that your system handles it fine, just pass the right -pic flag to configure.
Can't we check for that at configure time?
And I don't think we can do it at configure time currently. At least the
obvious --without-pic doesn't work. configure.in has:
unset with_pic
case $php_build_target in
program|static)
standard_libtool_flag='-prefer-non-pic -static'
if test -z "$PHP_MODULES"; then
enable_shared=no
fi
;;
shared)
enable_static=no
standard_libtool_flag=-prefer-pic
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module"
;;
esac
So it looks to me like the build target overrides the pic setting and
there is no way to build a shared library using -prefer-non-pic
-Rasmus
Not all dls support non-PIC code in DSOs. If you know that your system handles it fine, just pass the right -pic flag to configure.
Could we not add the appropriate checks to enable this setting for people's
who's dl support this? This is a fairly obscure point that most people are
not aware of and consequently suffer a significant and unnecessary
performance loss.
Ilia