Skip to content
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
ceval_warmup for windows
  • Loading branch information
neonene authored Sep 29, 2021
commit e76930f30355b52bc282955c11dde7d2ad0faeff
23 changes: 23 additions & 0 deletions Lib/test/libregrtest/pgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[:]