3

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.

user2586432
  • 249
  • 1
  • 4
  • 12
  • This is an interesting observation ... It's not really a question though. Is there something specific that you are trying to find out from this? If you want to know if there are better compiler flags, you'll need to give us more information (what compiler flags are you using?) – mgilson Nov 22 '16 at 05:27
  • Trying to figure out clang compiler flags which can optimise the python performance. – user2586432 Nov 22 '16 at 06:12

1 Answers1

1

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).

Community
  • 1
  • 1
yugr
  • 19,769
  • 3
  • 51
  • 96