简体   繁体   English

Python性能:Clang vs gcc

[英]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). 与使用gcc(GCC 4.6)编译的python相比,我观察到使用clang(Clang 3.4.1)编译的python的性能差异约为20%。

I am using configuration script that comes with python. 我正在使用python附带的配置脚本。 I am not sure if i am missing something on the optimisation of the clang complier. 我不确定我是否遗漏了关于clang编译器优化的内容。 Please comment. 请评论。

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 eg this post for more details). 纯粹的猜测在我身边,但Clang与GCC的一个巨大差异在于,Clang默认允许在共享库中内联函数(请参阅此帖子了解更多详情)。 This violates ELF interposition rules but usually allows to perform more aggressive optimizations. 这违反了ELF插入规则,但通常允许执行更积极的优化。

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 ). 默认情况下,GCC在这方面更严格,但您可以通过-fno-semantic-interposition (从GCC 5.3开始)要求相同的行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM