File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,15 @@ async def _compile(
137
137
f"-I{ CPYTHON / 'Include' / 'internal' / 'mimalloc' } " ,
138
138
f"-I{ CPYTHON / 'Python' } " ,
139
139
f"-I{ CPYTHON / 'Tools' / 'jit' } " ,
140
- "-O3" ,
140
+ # -O2 and -O3 include some optimizations that make sense for
141
+ # standalone functions, but not for snippets of code that are going
142
+ # to be laid out end-to-end (like ours)... common examples include
143
+ # passes like tail-duplication, or aligning jump targets with nops.
144
+ # -Os is equivalent to -O2 with many of these problematic passes
145
+ # disabled. Based on manual review, for *our* purposes it usually
146
+ # generates better code than -O2 (and -O2 usually generates better
147
+ # code than -O3). As a nice benefit, it uses less memory too:
148
+ "-Os" ,
141
149
"-S" ,
142
150
# Shorten full absolute file paths in the generated code (like the
143
151
# __FILE__ macro and assert failure messages) for reproducibility:
You can’t perform that action at this time.
0 commit comments