MCPcopy Index your code
hub / github.com/python/cpython / calc_specialization_effectiveness_table

Function calc_specialization_effectiveness_table

Tools/scripts/summarize_stats.py:987–1031  ·  view source on GitHub ↗
(stats: Stats)

Source from the content-addressed store, hash-verified

985
986def specialization_effectiveness_section() -> Section:
987 def calc_specialization_effectiveness_table(stats: Stats) -> Rows:
988 opcode_stats = stats.get_opcode_stats("opcode")
989 total = opcode_stats.get_total_execution_count()
990
991 (
992 basic,
993 specialized_hits,
994 specialized_misses,
995 not_specialized,
996 ) = opcode_stats.get_specialized_total_counts()
997
998 return [
999 (
1000 Doc(
1001 "Basic",
1002 "Instructions that are not and cannot be specialized, e.g. `LOAD_FAST`.",
1003 ),
1004 Count(basic),
1005 Ratio(basic, total),
1006 ),
1007 (
1008 Doc(
1009 "Not specialized",
1010 "Instructions that could be specialized but aren't, e.g. `LOAD_ATTR`, `BINARY_SLICE`.",
1011 ),
1012 Count(not_specialized),
1013 Ratio(not_specialized, total),
1014 ),
1015 (
1016 Doc(
1017 "Specialized hits",
1018 "Specialized instructions, e.g. `LOAD_ATTR_MODULE` that complete.",
1019 ),
1020 Count(specialized_hits),
1021 Ratio(specialized_hits, total),
1022 ),
1023 (
1024 Doc(
1025 "Specialized misses",
1026 "Specialized instructions, e.g. `LOAD_ATTR_MODULE` that deopt.",
1027 ),
1028 Count(specialized_misses),
1029 Ratio(specialized_misses, total),
1030 ),
1031 ]
1032
1033 def calc_deferred_by_table(stats: Stats) -> Rows:
1034 opcode_stats = stats.get_opcode_stats("opcode")

Callers

nothing calls this directly

Calls 6

CountClass · 0.85
get_opcode_statsMethod · 0.80
DocClass · 0.70
RatioClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…