Python upstream offers a "make profile-opt" target that automatically first builds an instrumented version (with gcc's -fprofile-generate), then runs some tests to train it and finally builds on optimized version with -fprofile-use. Offering a use flag for this feature would be nice. All recent gcc versions should work. Reproducible: Always
Marking this as a duplicate because the other bug has patches and more discussion. *** This bug has been marked as a duplicate of bug 615412 ***