Skip to content

Instantly share code, notes, and snippets.

@pitrou
Created September 13, 2015 17:26
Show Gist options
  • Save pitrou/512e9d4e3e1cb3ff51f2 to your computer and use it in GitHub Desktop.
Save pitrou/512e9d4e3e1cb3ff51f2 to your computer and use it in GitHub Desktop.
#!/bin/bash
LTO_CFLAGS="-g -flto -fuse-linker-plugin -ffat-lto-objects -O3"
./configure --enable-ipv6 --with-ensurepip=upgrade \
CFLAGS="$LTO_CFLAGS" LDFLAGS="$LTO_CFLAGS"
# The following is basically "make profile-opt", but with additional
# flexibility if you want to add e.g. "-j4" when building
# Tests to exclude from the profiling run (too slow, or crashy)
EXCLUDE_TESTS="test_gdb test_subprocess test_faulthandler \
test_multiprocessing test_multiprocessing_fork \
test_multiprocessing_forkserver test_multiprocessing_spawn \
test_multiprocessing_main_handling test_signal \
test_concurrent_futures test_ioctl test_threaded_import \
test_threadsignals"
PROFILE_TASK="-m test.regrtest -w -x $EXCLUDE_TESTS"
# Build with support for profile generation
make build_all_generate_profile -j5
# Run workload to generate profile data
# Errors in the test suite are ignored
make run_profile_task PROFILE_TASK="$PROFILE_TASK" || true
# Rebuild with profile guided optimizations
make clean
make build_all_use_profile -j5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment