mirror of
https://github.com/python/cpython.git
synced 2025-07-14 06:45:17 +00:00
gh-100239: more refined specialisation stats for BINARY_OP/SUBSCR (#132068)
This commit is contained in:
parent
72123063dd
commit
df59226997
3 changed files with 47 additions and 4 deletions
|
@ -298,12 +298,20 @@ class OpcodeStats:
|
|||
return "kind " + str(kind)
|
||||
|
||||
family_stats = self._get_stats_for_opcode(opcode)
|
||||
failure_kinds = [0] * 40
|
||||
|
||||
def key_to_index(key):
|
||||
return int(key[:-1].split("[")[1])
|
||||
|
||||
max_index = 0
|
||||
for key in family_stats:
|
||||
if key.startswith("specialization.failure_kind"):
|
||||
max_index = max(max_index, key_to_index(key))
|
||||
|
||||
failure_kinds = [0] * (max_index + 1)
|
||||
for key in family_stats:
|
||||
if not key.startswith("specialization.failure_kind"):
|
||||
continue
|
||||
index = int(key[:-1].split("[")[1])
|
||||
failure_kinds[index] = family_stats[key]
|
||||
failure_kinds[key_to_index(key)] = family_stats[key]
|
||||
return {
|
||||
kind_to_text(index, opcode): value
|
||||
for (index, value) in enumerate(failure_kinds)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue