user2586432
user2586432

Reputation: 249

Python performance : Clang vs gcc

I am observing around 20% performance difference with python compiled with clang (Clang 3.4.1 ) when compared to python compiled with gcc (GCC 4.6).

I am using configuration script that comes with python. I am not sure if i am missing something on the optimisation of the clang complier. Please comment.

Upvotes: 3

Views: 1750

Answers (1)

yugr
yugr

Reputation: 21955

Pure guesswork on my side but one huge difference of Clang vs. GCC is that Clang by default allows inlining of interposable functions in shared libraries (see e.g. this post for more details). This violates ELF interposition rules but usually allows to perform more aggressive optimizations.

GCC is more strict in this regard by default but you can ask for the same behavior with -fno-semantic-interposition (starting with GCC 5.3).

Upvotes: 1

Related Questions