Repository navigation
.github: build the Linux extension with Python's compile flags - #798
Open
mario4tier wants to merge 1 commit into
Open
mario4tier wants to merge 1 commit into
mario4tier wants to merge 1 commit into
Conversation
The Linux jobs exported CFLAGS=-D_GNU_SOURCE. setuptools uses an environment CFLAGS in place of the interpreter's own, so the Cython extension was compiled without -O3 and -DNDEBUG. The TA-Lib C library inside the wheel was not affected: CMake builds it Release. Remove the setting. It was added for the 0.7.1 build of the C library's tools, which setup.py no longer builds, and Python.h defines _GNU_SOURCE for the extension itself. Python's flags include -g, so strip the repaired wheels to keep their size.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since 0.7.1 the Linux jobs set
CFLAGS=-D_GNU_SOURCE. setuptools uses an environmentCFLAGSin place of Python's own compile flags, so the Cython extension in the Linux wheels is compiled without optimisation:Only the wrapper code is affected: the C library inside the wheel is already built at
-O3, and the macOS and Windows jobs never setCFLAGS._GNU_SOURCEwas for the C library's tools, whichsetup.pyno longer builds.Time per call on an i7-13700K, two CPython 3.12 manylinux wheels built from the same source with and without the
CFLAGSsetting (pinned core, best of 6 alternating runs):CFLAGSSMA, 100 barsSMA, 1,000 barsSMA, 100,000 barsRSI, 100 barsBBANDS, 100 barsMACD, 1,000 barsstream.SMA, 100 barsabstract.Function('SMA')(inputs), 100 barsabstract.Function('SMA')The gain is in the per-call overhead, so it fades as the series grows. A Ryzen 7 PRO 8840U shows the same direction.
The cost is build time: the Linux jobs took 82 min (x86_64) and 105 min (arm64) in the test run, against 43 and 44 min for 0.8.3.post1. Python's flags include
-g, so the wheels are repaired withauditwheel repair --strip, which removes the debug info and the symbol table (cp312 manylinux x86_64: 5.0 MB today, 4.6 MB with this PR).Tested with a full
wheels.ymlrun on master plus this PR and #797.