Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-45116 Add a warm-up for PGO training on Windows #28631

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Lib/test/libregrtest/pgo.py
Original file line number Diff line number Diff line change
@@ -50,7 +50,30 @@
'test_xml_etree_c',
]

def ceval_warmup():
# MSVC needs additional ceval-loop counts for better performance.
import sys
if sys.platform != 'win32':
return

def noop_trace(frame, event, arg):
return noop_trace

print("warmup for tests on Windows...")
old_trace = sys.gettrace()
sys.settrace(noop_trace)
try:
jobcnt = len(PGO_TESTS)
for j in range(1, 1 + jobcnt):
print(f'{j}/{jobcnt}')
for i in range(800000):
pass
finally:
sys.settrace(old_trace)


def setup_pgo_tests(ns):
ceval_warmup()
if not ns.args and not ns.pgo_extended:
# run default set of tests for PGO training
ns.args = PGO_TESTS[:]