Skip to content

Instantly share code, notes, and snippets.

@stefantalpalaru
Created May 28, 2018 12:23
Show Gist options
  • Save stefantalpalaru/a1f31b9dff6c2227999e32781741dd01 to your computer and use it in GitHub Desktop.
Save stefantalpalaru/a1f31b9dff6c2227999e32781741dd01 to your computer and use it in GitHub Desktop.
replicate PGO ICE with Python-2.7.15 and GCC
wget "https://github.com/python/cpython/archive/v2.7.15.tar.gz"
tar xzf v2.7.15.tar.gz
# patch to enable PGO for extensions and leave the *.gcda files at the end
wget "https://gist.githubusercontent.com/stefantalpalaru/3035b87a48cc273585ee69f95e8343bf/raw/874ea6507321e22ff5c7a106ceb36d2d41787b43/python-2.7.15-PGO-ICE.patch"
cd cpython-2.7.15
patch -p1 -i ../python-2.7.15-PGO-ICE.patch
CFLAGS="-O3 -march=native -pipe" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common" ./configure --enable-optimizations --with-lto
make -j8 EXTRATESTOPTS="-j8" 2>&1 | tee build.log
grep '\btimemodule\.c' build.log
find -name 'timemodule.gcda' -exec gcov-dump '{}' \; | head | cut -d ':' -f 2-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment