disable LTO because become poor performance

This commit is contained in:
PyYoshi 2018-09-27 00:43:10 +09:00
parent 9b765a55e6
commit d5411b36b7
4 changed files with 13 additions and 15 deletions

View file

@ -4,7 +4,7 @@ CHANGES
2.1.x 2.1.x
----- -----
- xxxx - disable LTO because become poor performance
2.1.3 (2018-09-26) 2.1.3 (2018-09-26)
------------------ ------------------

View file

@ -19,17 +19,7 @@ install: clean
build-manylinux1-wheel: build-manylinux1-wheel:
docker pull quay.io/pypa/manylinux1_i686 docker pull quay.io/pypa/manylinux1_i686
docker pull quay.io/pypa/manylinux1_x86_64 docker pull quay.io/pypa/manylinux1_x86_64
docker run --rm -ti -v `pwd`:/project \ docker run --rm -ti -v `pwd`:/project -w /project quay.io/pypa/manylinux1_i686 bash dockerfiles/buildwheel.sh
-e CFLAGS="-mtune=generic -pipe -fPIC -flto" \ docker run --rm -ti -v `pwd`:/project -w /project quay.io/pypa/manylinux1_x86_64 bash dockerfiles/buildwheel.sh
-e LDFLAGS="$(LDFLAGS) -flto" \
-w /project \
quay.io/pypa/manylinux1_i686 \
bash dockerfiles/buildwheel.sh
docker run --rm -ti -v `pwd`:/project \
-e CFLAGS="-mtune=generic -pipe -fPIC -flto" \
-e LDFLAGS="$(LDFLAGS) -flto" \
-w /project \
quay.io/pypa/manylinux1_x86_64 \
bash dockerfiles/buildwheel.sh
build: clean pip test sdist build-manylinux1-wheel build: clean pip test sdist build-manylinux1-wheel

View file

@ -3,3 +3,5 @@ Cython==0.28.5
nose==1.3.7 nose==1.3.7
tox==3.4.0 tox==3.4.0
wheel==0.31.1 wheel==0.31.1
#autopep8==1.4
#pylint==2.1.1

View file

@ -26,7 +26,8 @@ uchardet_dir = 'src/ext/uchardet/src'
if have_cython: if have_cython:
pyx_sources = glob.glob(cchardet_dir + '*.pyx') pyx_sources = glob.glob(cchardet_dir + '*.pyx')
sys.stderr.write('cythonize: %r\n' % (pyx_sources,)) sys.stderr.write('cythonize: %r\n' % (pyx_sources,))
cython_compiler.compile(pyx_sources, options=cython_compiler.CompilationOptions(cplus=True)) cython_compiler.compile(
pyx_sources, options=cython_compiler.CompilationOptions(cplus=True))
cchardet_sources = glob.glob(cchardet_dir + '*.cpp') cchardet_sources = glob.glob(cchardet_dir + '*.cpp')
sources = cchardet_sources sources = cchardet_sources
@ -89,6 +90,8 @@ cfg_vars = sysconfig.get_config_vars()
for key, value in cfg_vars.items(): for key, value in cfg_vars.items():
if type(value) == str: if type(value) == str:
cfg_vars[key] = value.replace("-Wstrict-prototypes", "") cfg_vars[key] = value.replace("-Wstrict-prototypes", "")
# O3を指定したところで速度が向上するかは疑問である
# cfg_vars[key] = value.replace("-O2", "-O3")
cchardet_module = Extension( cchardet_module = Extension(
'cchardet._cchardet', 'cchardet._cchardet',
@ -97,12 +100,15 @@ cchardet_module = Extension(
language='c++', language='c++',
) )
def read(f): def read(f):
return open(os.path.join(os.path.dirname(__file__), f)).read().strip() return open(os.path.join(os.path.dirname(__file__), f)).read().strip()
with codecs.open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'src', 'cchardet', 'version.py'), 'r', 'latin1') as fp: with codecs.open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'src', 'cchardet', 'version.py'), 'r', 'latin1') as fp:
try: try:
version = re.findall(r"^__version__ = '([^']+)'\r?$", fp.read(), re.M)[0] version = re.findall(
r"^__version__ = '([^']+)'\r?$", fp.read(), re.M)[0]
except IndexError: except IndexError:
raise RuntimeError('Unable to determine version.') raise RuntimeError('Unable to determine version.')