NYCPHP Meetup

NYPHP.org

[nycphp-talk] --with-pic ... what's pic?

Ajai Khattri ajai at bitblit.net
Tue Nov 15 23:22:09 EST 2005


Chris Shiflett wrote:

>(PIC == Position Independent Code)
>
>The performance gurus tell us to compile PHP with -prefer-non-pic (for 
>DSOs to match the performance of a static library):
>  
>

(Dusting off and putting on my old C coding hat)

Presumably, the overhead of having to re-calculate memory addresses when 
loading a library into memory makes PIC objects larger (since there is 
relocation code) and slightly slower (because of the calculation). A 
static library would have fixed addresses, so a static library would be 
slightly smaller and faster to load. However, their is a price to pay - 
you dont get any of the benefits that a shared library brings to the 
table (which means each application would load and use its own copy of a 
static library and so you would use much more memory overall).

I would argue that using static libraries only gives you benefits when 
initially loading a library into memory but that the increased memory 
usage would probably outweigh these benefits pretty quickly (picture a 
web server where each PHP application has its own libraries loaded into 
memory instead of sharing one instance across all instantiations and you 
will get the picture). Also, with today's faster CPUs and memory, the 
intial load time is getting smaller all the time...



-- 
Aj.



More information about the talk mailing list