https://github.com/python/cpython/commit/c49dc3bd0f0ac57a038e9ba63e83cfa424e91b2a commit: c49dc3bd0f0ac57a038e9ba63e83cfa424e91b2a branch: main author: Brandt Bucher <brandtbuc...@microsoft.com> committer: brandtbucher <brandtbuc...@gmail.com> date: 2025-07-09T12:11:28-07:00 summary:
GH-115802: Optimize JIT stencils for size (GH-136393) files: M Tools/jit/_targets.py diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index ed10329d25d2f9..728f48128ce79c 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -137,7 +137,15 @@ async def _compile( f"-I{CPYTHON / 'Include' / 'internal' / 'mimalloc'}", f"-I{CPYTHON / 'Python'}", f"-I{CPYTHON / 'Tools' / 'jit'}", - "-O3", + # -O2 and -O3 include some optimizations that make sense for + # standalone functions, but not for snippets of code that are going + # to be laid out end-to-end (like ours)... common examples include + # passes like tail-duplication, or aligning jump targets with nops. + # -Os is equivalent to -O2 with many of these problematic passes + # disabled. Based on manual review, for *our* purposes it usually + # generates better code than -O2 (and -O2 usually generates better + # code than -O3). As a nice benefit, it uses less memory too: + "-Os", "-S", # Shorten full absolute file paths in the generated code (like the # __FILE__ macro and assert failure messages) for reproducibility: _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: arch...@mail-archive.com