Python Forum

Full Version: Why does Cython generates bad code for Gentoo?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Kubuntu 19.10 / Gentoo

I wrote a Python- program, that uses a small computational core, written with a Cython. Having tested on Kubuntu and Gentoo, I found that pure Python code (without a computational core) runs faster on a Gentoo (~+33%), but the Cython computational core runs about 1.5 times faster on a Kubuntu. As a result, the entire program runs faster on a Kubuntu.

I tried to transfer various combinations of options in a pyx- files:
# distutils: extra_compile_args = ["- O2", "-march = haswell", "-ftree-vectorize"]
, but this does not improve the speed of the Cython- code on a Gentoo.

How to speed up work of my program on a Gentoo?
Moreover, adding the -O2 option improved the performance, but not enough (i.e. these settings affect the performance).