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

Method get_optimization_stats

Tools/scripts/summarize_stats.py:453–529  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

451 return gc_stats
452
453 def get_optimization_stats(self) -> dict[str, tuple[int, int | None]]:
454 if "Optimization attempts" not in self._data:
455 return {}
456
457 attempts = self._data["Optimization attempts"]
458 created = self._data["Optimization traces created"]
459 executed = self._data["Optimization traces executed"]
460 uops = self._data["Optimization uops executed"]
461 trace_stack_overflow = self._data["Optimization trace stack overflow"]
462 trace_stack_underflow = self._data["Optimization trace stack underflow"]
463 trace_too_long = self._data["Optimization trace too long"]
464 trace_too_short = self._data["Optimization trace too short"]
465 inner_loop = self._data["Optimization inner loop"]
466 recursive_call = self._data["Optimization recursive call"]
467 low_confidence = self._data["Optimization low confidence"]
468 unknown_callee = self._data["Optimization unknown callee"]
469 executors_invalidated = self._data["Executors invalidated"]
470
471 return {
472 Doc(
473 "Optimization attempts",
474 "The number of times a potential trace is identified. Specifically, this "
475 "occurs in the JUMP BACKWARD instruction when the counter reaches a "
476 "threshold.",
477 ): (attempts, None),
478 Doc(
479 "Traces created", "The number of traces that were successfully created."
480 ): (created, attempts),
481 Doc(
482 "Trace stack overflow",
483 "A trace is truncated because it would require more than 5 stack frames.",
484 ): (trace_stack_overflow, attempts),
485 Doc(
486 "Trace stack underflow",
487 "A potential trace is abandoned because it pops more frames than it pushes.",
488 ): (trace_stack_underflow, attempts),
489 Doc(
490 "Trace too long",
491 "A trace is truncated because it is longer than the instruction buffer.",
492 ): (trace_too_long, attempts),
493 Doc(
494 "Trace too short",
495 "A potential trace is abandoned because it is too short.",
496 ): (trace_too_short, attempts),
497 Doc(
498 "Inner loop found", "A trace is truncated because it has an inner loop"
499 ): (inner_loop, attempts),
500 Doc(
501 "Recursive call",
502 "A trace is truncated because it has a recursive call.",
503 ): (recursive_call, attempts),
504 Doc(
505 "Low confidence",
506 "A trace is abandoned because the likelihood of the jump to top being taken "
507 "is too low.",
508 ): (low_confidence, attempts),
509 Doc(
510 "Unknown callee",

Callers 2

calc_optimization_tableFunction · 0.80
iter_optimization_tablesFunction · 0.80

Calls 1

DocClass · 0.70

Tested by

no test coverage detected