Skip to content

Commit fcecce3

Browse files
committed
Skip optimisations to speedup test_freeze rebuild
1 parent f715d25 commit fcecce3

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Tools/freeze/test/freeze.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ def find_opt(args, name):
6464
return -1
6565

6666

67+
def remove_opt(args: list[str], name: str) -> None:
68+
opt = f'--{name}'
69+
optstart = f'{opt}='
70+
args[:] = [
71+
arg
72+
for arg in args
73+
if arg != opt and not arg.startswith(optstart)
74+
]
75+
76+
6777
def ensure_opt(args, name, value):
6878
opt = f'--{name}'
6979
pos = find_opt(args, name)
@@ -128,6 +138,10 @@ def prepare(script=None, outdir=None):
128138
# Run configure.
129139
print(f'configuring python in {builddir}...')
130140
config_args = shlex.split(sysconfig.get_config_var('CONFIG_ARGS') or '')
141+
# Optimisations such as LTO and PGO only slow down the build of this
142+
# throwaway interpreter without affecting what the test checks.
143+
remove_opt(config_args, 'enable-optimizations')
144+
remove_opt(config_args, 'with-lto')
131145
cmd = [os.path.join(srcdir, 'configure'), *config_args]
132146
ensure_opt(cmd, 'cache-file', os.path.join(outdir, 'python-config.cache'))
133147
prefix = os.path.join(outdir, 'python-installation')

0 commit comments

Comments
 (0)