Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22079

PIC performance in static libraries

$
0
0

I'm using yaml-cpp library, which by default generates position dependent static library (libyaml-cpp.a). My own library compiles into two versions, static and shared. Since I need shared one, I have to turn on PIC for the yaml-cpp (that's the easy part). Now however, do I suffer performance hit in the static library? If yes, how big?

Basically, I have three options:

  1. compile yaml-cpp twice, once position dependent and once PIC, link appropriate onces into mine shared and static library
    • Pros: probably best perfomance wise, both mine shared and static and use same object files (meaning .cpp are compiled only once)
    • Cons: probably most setup, yaml-cpp will be compiled twice but that should not matter, I'll be not changing it (that often)
  2. compile yaml-cpp once as PIC, link it into mine shared (PIC) and static (not PIC)
    • Pros: easy to setup
    • Cons: source codes need to compile twice (shared (PIC), static (non PIC))
  3. compile yaml-cpp once as PIC and compile both mine (shared & static) as PIC too
    • Pros: easy to setup
    • Cons: slight perfomance hit in static one?

So the option 1 seems like the best one. Do I have any false assumptions in my summary? Or did I miss any other option?

Platform: amd64


Viewing all articles
Browse latest Browse all 22079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>