id int64 1 6.07M | name stringlengths 1 295 | code stringlengths 12 426k | language stringclasses 1
value | source_file stringlengths 5 202 | start_line int64 1 158k | end_line int64 1 158k | repo dict |
|---|---|---|---|---|---|---|---|
9,401 | deque_append_popleft | def deque_append_popleft(trials=trials, a=deque([1])):
ap, pop = a.append, a.popleft
for t in trials:
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1... | python | Tools/scripts/var_access_benchmark.py | 225 | 232 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,402 | write_list | def write_list(trials=trials, a=[1]):
for t in trials:
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1 | python | Tools/scripts/var_access_benchmark.py | 234 | 240 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,403 | write_deque | def write_deque(trials=trials, a=deque([1])):
for t in trials:
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1 | python | Tools/scripts/var_access_benchmark.py | 242 | 248 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,404 | write_dict | def write_dict(trials=trials, a={0: 1}):
for t in trials:
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1 | python | Tools/scripts/var_access_benchmark.py | 250 | 256 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,405 | write_strdict | def write_strdict(trials=trials, a={'key': 1}):
for t in trials:
a['key']=1; a['key']=1; a['key']=1; a['key']=1; a['key']=1
a['key']=1; a['key']=1; a['key']=1; a['key']=1; a['key']=1
a['key']=1; a['key']=1; a['key']=1; a['key']=1; a['key']=1
a['key']=1; a['key']=1; a['key']=1; a['key... | python | Tools/scripts/var_access_benchmark.py | 258 | 264 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,406 | loop_overhead | def loop_overhead(trials=trials):
for t in trials:
pass | python | Tools/scripts/var_access_benchmark.py | 266 | 268 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,407 | rand_digits | def rand_digits(n):
top = 1 << (n * BITS_PER_DIGIT)
return randrange(top >> 1, top) | python | Tools/scripts/divmod_threshold.py | 13 | 15 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,408 | probe_den | def probe_den(nd):
den = rand_digits(nd)
count = 0
for nn in range(nd, nd + 3000):
num = rand_digits(nn)
t0 = now()
e1, e2 = divmod(num, den)
t1 = now()
f1, f2 = divmod_fast(num, den)
t2 = now()
s1 = t1 - t0
s2 = t2 - t1
assert e1 == f1... | python | Tools/scripts/divmod_threshold.py | 18 | 46 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,409 | main | def main():
for nd in range(30):
nd = (nd + 1) * 100
probe_den(nd) | python | Tools/scripts/divmod_threshold.py | 49 | 52 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,410 | _random_data | def _random_data(size: int, rand: random.Random) -> list[float]:
result = [rand.random() for _ in range(size)]
# Shuffle it a bit...
for i in range(10):
i = rand.randrange(size)
temp = result[:i]
del result[:i]
temp.reverse()
result.extend(temp)
del temp
a... | python | Tools/scripts/sortperf.py | 32 | 43 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,411 | list_sort | def list_sort(size: int, rand: random.Random) -> list[float]:
return _random_data(size, rand) | python | Tools/scripts/sortperf.py | 46 | 47 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,412 | list_sort_descending | def list_sort_descending(size: int, rand: random.Random) -> list[float]:
return list(reversed(list_sort_ascending(size, rand))) | python | Tools/scripts/sortperf.py | 50 | 51 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,413 | list_sort_ascending | def list_sort_ascending(size: int, rand: random.Random) -> list[float]:
return sorted(_random_data(size, rand)) | python | Tools/scripts/sortperf.py | 54 | 55 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,414 | list_sort_ascending_exchanged | def list_sort_ascending_exchanged(size: int, rand: random.Random) -> list[float]:
result = list_sort_ascending(size, rand)
# Do 3 random exchanges.
for _ in range(3):
i1 = rand.randrange(size)
i2 = rand.randrange(size)
result[i1], result[i2] = result[i2], result[i1]
return result | python | Tools/scripts/sortperf.py | 58 | 65 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,415 | list_sort_ascending_random | def list_sort_ascending_random(size: int, rand: random.Random) -> list[float]:
assert size >= 10, "This benchmark requires size to be >= 10"
result = list_sort_ascending(size, rand)
# Replace the last 10 with random floats.
result[-10:] = [rand.random() for _ in range(10)]
return result | python | Tools/scripts/sortperf.py | 68 | 73 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,416 | list_sort_ascending_one_percent | def list_sort_ascending_one_percent(size: int, rand: random.Random) -> list[float]:
result = list_sort_ascending(size, rand)
# Replace 1% of the elements at random.
for _ in range(size // 100):
result[rand.randrange(size)] = rand.random()
return result | python | Tools/scripts/sortperf.py | 76 | 81 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,417 | list_sort_duplicates | def list_sort_duplicates(size: int, rand: random.Random) -> list[float]:
assert size >= 4
result = list_sort_ascending(4, rand)
# Arrange for lots of duplicates.
result = result * (size // 4)
# Force the elements to be distinct objects, else timings can be
# artificially low.
return list(map... | python | Tools/scripts/sortperf.py | 84 | 91 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,418 | list_sort_equal | def list_sort_equal(size: int, rand: random.Random) -> list[float]:
# All equal. Again, force the elements to be distinct objects.
return list(map(abs, [-0.519012] * size)) | python | Tools/scripts/sortperf.py | 94 | 96 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,419 | list_sort_worst_case | def list_sort_worst_case(size: int, rand: random.Random) -> list[float]:
# This one looks like [3, 2, 1, 0, 0, 1, 2, 3]. It was a bad case
# for an older implementation of quicksort, which used the median
# of the first, last and middle elements as the pivot.
half = size // 2
result = list(range(ha... | python | Tools/scripts/sortperf.py | 99 | 108 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,420 | __init__ | def __init__(self, name: str, size: int, seed: int) -> None:
self._name = name
self._size = size
self._seed = seed
self._random = random.Random(self._seed) | python | Tools/scripts/sortperf.py | 116 | 120 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,421 | run | def run(self, loops: int) -> float:
all_data = self._prepare_data(loops)
start = time.perf_counter()
for data in all_data:
data.sort() # Benching this method!
return time.perf_counter() - start | python | Tools/scripts/sortperf.py | 122 | 129 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,422 | _prepare_data | def _prepare_data(self, loops: int) -> list[float]:
bench = BENCHMARKS[self._name]
data = bench(self._size, self._random)
return [data.copy() for _ in range(loops)] | python | Tools/scripts/sortperf.py | 131 | 134 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,423 | add_cmdline_args | def add_cmdline_args(cmd: list[str], args) -> None:
if args.benchmark:
cmd.append(args.benchmark)
cmd.append(f"--size={args.size}")
cmd.append(f"--rng-seed={args.rng_seed}") | python | Tools/scripts/sortperf.py | 137 | 141 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,424 | add_parser_args | def add_parser_args(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"benchmark",
choices=BENCHMARKS,
nargs="?",
help="Can be any of: {0}".format(", ".join(BENCHMARKS)),
)
parser.add_argument(
"--size",
type=int,
default=DEFAULT_SIZE,
... | python | Tools/scripts/sortperf.py | 144 | 162 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,425 | pretty | def pretty(name: str) -> str:
return name.replace("_", " ").lower() | python | Tools/scripts/summarize_stats.py | 50 | 51 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,426 | _load_metadata_from_source | def _load_metadata_from_source():
def get_defines(filepath: Path, prefix: str = "SPEC_FAIL"):
with open(SOURCE_DIR / filepath) as spec_src:
defines = collections.defaultdict(list)
start = "#define " + prefix + "_"
for line in spec_src:
line = line.strip()
... | python | Tools/scripts/summarize_stats.py | 54 | 78 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,427 | get_defines | def get_defines(filepath: Path, prefix: str = "SPEC_FAIL"):
with open(SOURCE_DIR / filepath) as spec_src:
defines = collections.defaultdict(list)
start = "#define " + prefix + "_"
for line in spec_src:
line = line.strip()
if not line.startswith... | python | Tools/scripts/summarize_stats.py | 55 | 66 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,428 | load_raw_data | def load_raw_data(input: Path) -> RawData:
if input.is_file():
with open(input, "r") as fd:
data = json.load(fd)
data["_stats_defines"] = {int(k): v for k, v in data["_stats_defines"].items()}
data["_defines"] = {int(k): v for k, v in data["_defines"].items()}
return da... | python | Tools/scripts/summarize_stats.py | 81 | 117 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,429 | save_raw_data | def save_raw_data(data: RawData, json_output: TextIO):
json.dump(data, json_output) | python | Tools/scripts/summarize_stats.py | 120 | 121 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,430 | markdown | def markdown(self) -> str:
return textwrap.dedent(
f"""
{self.text}
<details>
<summary>ⓘ</summary>
{self.doc}
</details>
"""
) | python | Tools/scripts/summarize_stats.py | 129 | 139 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,431 | markdown | def markdown(self) -> str:
return format(self, ",d") | python | Tools/scripts/summarize_stats.py | 143 | 144 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,432 | __float__ | def __float__(self):
if self.den == 0:
return 0.0
elif self.den is None:
return self.num
else:
return self.num / self.den | python | Tools/scripts/summarize_stats.py | 153 | 159 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,433 | markdown | def markdown(self) -> str:
if self.den is None:
return ""
elif self.den == 0:
if self.num != 0:
return f"{self.num:,} / 0 !!"
return ""
elif self.percentage:
return f"{self.num / self.den:,.01%}"
else:
return f"{... | python | Tools/scripts/summarize_stats.py | 161 | 171 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,434 | __init__ | def __init__(self, base: int | str, head: int | str):
if isinstance(base, str) or isinstance(head, str):
super().__init__(0, 0)
else:
super().__init__(head - base, base) | python | Tools/scripts/summarize_stats.py | 175 | 179 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,435 | __init__ | def __init__(self, data: dict[str, Any], defines, specialized_instructions):
self._data = data
self._defines = defines
self._specialized_instructions = specialized_instructions | python | Tools/scripts/summarize_stats.py | 188 | 191 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,436 | get_opcode_names | def get_opcode_names(self) -> KeysView[str]:
return self._data.keys() | python | Tools/scripts/summarize_stats.py | 193 | 194 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,437 | get_pair_counts | def get_pair_counts(self) -> dict[tuple[str, str], int]:
pair_counts = {}
for name_i, opcode_stat in self._data.items():
for key, value in opcode_stat.items():
if value and key.startswith("pair_count"):
name_j, _, _ = key[len("pair_count") + 1 :].partition... | python | Tools/scripts/summarize_stats.py | 196 | 203 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,438 | get_total_execution_count | def get_total_execution_count(self) -> int:
return sum(x.get("execution_count", 0) for x in self._data.values()) | python | Tools/scripts/summarize_stats.py | 205 | 206 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,439 | get_execution_counts | def get_execution_counts(self) -> dict[str, tuple[int, int]]:
counts = {}
for name, opcode_stat in self._data.items():
if "execution_count" in opcode_stat:
count = opcode_stat["execution_count"]
miss = 0
if "specializable" not in opcode_stat:
... | python | Tools/scripts/summarize_stats.py | 208 | 217 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,440 | _get_pred_succ | def _get_pred_succ(
self,
) -> tuple[dict[str, collections.Counter], dict[str, collections.Counter]]:
pair_counts = self.get_pair_counts()
predecessors: dict[str, collections.Counter] = collections.defaultdict(
collections.Counter
)
successors: dict[str, collecti... | python | Tools/scripts/summarize_stats.py | 220 | 236 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,441 | get_predecessors | def get_predecessors(self, opcode: str) -> collections.Counter[str]:
return self._get_pred_succ()[0][opcode] | python | Tools/scripts/summarize_stats.py | 238 | 239 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,442 | get_successors | def get_successors(self, opcode: str) -> collections.Counter[str]:
return self._get_pred_succ()[1][opcode] | python | Tools/scripts/summarize_stats.py | 241 | 242 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,443 | _get_stats_for_opcode | def _get_stats_for_opcode(self, opcode: str) -> dict[str, int]:
return self._data[opcode] | python | Tools/scripts/summarize_stats.py | 244 | 245 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,444 | get_specialization_total | def get_specialization_total(self, opcode: str) -> int:
family_stats = self._get_stats_for_opcode(opcode)
return sum(family_stats.get(kind, 0) for kind in TOTAL) | python | Tools/scripts/summarize_stats.py | 247 | 249 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,445 | get_specialization_counts | def get_specialization_counts(self, opcode: str) -> dict[str, int]:
family_stats = self._get_stats_for_opcode(opcode)
result = {}
for key, value in sorted(family_stats.items()):
if key.startswith("specialization."):
label = key[len("specialization.") :]
... | python | Tools/scripts/summarize_stats.py | 251 | 269 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,446 | get_specialization_success_failure | def get_specialization_success_failure(self, opcode: str) -> dict[str, int]:
family_stats = self._get_stats_for_opcode(opcode)
result = {}
for key in ("specialization.success", "specialization.failure"):
label = key[len("specialization.") :]
val = family_stats.get(key, 0)... | python | Tools/scripts/summarize_stats.py | 271 | 278 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,447 | get_specialization_failure_total | def get_specialization_failure_total(self, opcode: str) -> int:
return self._get_stats_for_opcode(opcode).get("specialization.failure", 0) | python | Tools/scripts/summarize_stats.py | 280 | 281 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,448 | get_specialization_failure_kinds | def get_specialization_failure_kinds(self, opcode: str) -> dict[str, int]:
def kind_to_text(kind: int, opcode: str):
if kind <= 8:
return pretty(self._defines[kind][0])
if opcode == "LOAD_SUPER_ATTR":
opcode = "SUPER"
elif opcode.endswith("ATTR... | python | Tools/scripts/summarize_stats.py | 283 | 311 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,449 | kind_to_text | def kind_to_text(kind: int, opcode: str):
if kind <= 8:
return pretty(self._defines[kind][0])
if opcode == "LOAD_SUPER_ATTR":
opcode = "SUPER"
elif opcode.endswith("ATTR"):
opcode = "ATTR"
elif opcode in ("FOR_ITER", "SEND")... | python | Tools/scripts/summarize_stats.py | 284 | 298 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,450 | is_specializable | def is_specializable(self, opcode: str) -> bool:
return "specializable" in self._get_stats_for_opcode(opcode) | python | Tools/scripts/summarize_stats.py | 313 | 314 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,451 | get_specialized_total_counts | def get_specialized_total_counts(self) -> tuple[int, int, int]:
basic = 0
specialized_hits = 0
specialized_misses = 0
not_specialized = 0
for opcode, opcode_stat in self._data.items():
if "execution_count" not in opcode_stat:
continue
count... | python | Tools/scripts/summarize_stats.py | 316 | 333 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,452 | get_deferred_counts | def get_deferred_counts(self) -> dict[str, int]:
return {
opcode: opcode_stat.get("specialization.deferred", 0)
for opcode, opcode_stat in self._data.items()
if opcode != "RESUME"
} | python | Tools/scripts/summarize_stats.py | 335 | 340 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,453 | get_misses_counts | def get_misses_counts(self) -> dict[str, int]:
return {
opcode: opcode_stat.get("specialization.miss", 0)
for opcode, opcode_stat in self._data.items()
if not self.is_specializable(opcode)
} | python | Tools/scripts/summarize_stats.py | 342 | 347 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,454 | get_opcode_counts | def get_opcode_counts(self) -> dict[str, int]:
counts = {}
for opcode, entry in self._data.items():
count = entry.get("count", 0)
if count:
counts[opcode] = count
return counts | python | Tools/scripts/summarize_stats.py | 349 | 355 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,455 | __init__ | def __init__(self, data: RawData):
self._data = data | python | Tools/scripts/summarize_stats.py | 359 | 360 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,456 | get | def get(self, key: str) -> int:
return self._data.get(key, 0) | python | Tools/scripts/summarize_stats.py | 362 | 363 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,457 | get_opcode_stats | def get_opcode_stats(self, prefix: str) -> OpcodeStats:
opcode_stats = collections.defaultdict[str, dict](dict)
for key, value in self._data.items():
if not key.startswith(prefix):
continue
name, _, rest = key[len(prefix) + 1 :].partition("]")
opcode_s... | python | Tools/scripts/summarize_stats.py | 366 | 377 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,458 | get_call_stats | def get_call_stats(self) -> dict[str, int]:
defines = self._data["_stats_defines"]
result = {}
for key, value in sorted(self._data.items()):
if "Calls to" in key:
result[key] = value
elif key.startswith("Calls "):
name, index = key[:-1].spl... | python | Tools/scripts/summarize_stats.py | 379 | 394 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,459 | get_object_stats | def get_object_stats(self) -> dict[str, tuple[int, int]]:
total_materializations = self._data.get("Object inline values", 0)
total_allocations = self._data.get("Object allocations", 0) + self._data.get(
"Object allocations from freelist", 0
)
total_increfs = self._data.get(
... | python | Tools/scripts/summarize_stats.py | 396 | 424 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,460 | get_gc_stats | def get_gc_stats(self) -> list[dict[str, int]]:
gc_stats: list[dict[str, int]] = []
for key, value in self._data.items():
if not key.startswith("GC"):
continue
n, _, rest = key[3:].partition("]")
name = rest.strip()
gen_n = int(n)
... | python | Tools/scripts/summarize_stats.py | 426 | 437 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,461 | get_optimization_stats | def get_optimization_stats(self) -> dict[str, tuple[int, int | None]]:
if "Optimization attempts" not in self._data:
return {}
attempts = self._data["Optimization attempts"]
created = self._data["Optimization traces created"]
executed = self._data["Optimization traces execut... | python | Tools/scripts/summarize_stats.py | 439 | 510 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,462 | get_optimizer_stats | def get_optimizer_stats(self) -> dict[str, tuple[int, int | None]]:
attempts = self._data["Optimization optimizer attempts"]
successes = self._data["Optimization optimizer successes"]
no_memory = self._data["Optimization optimizer failure no memory"]
builtins_changed = self._data["Optimi... | python | Tools/scripts/summarize_stats.py | 512 | 540 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,463 | get_histogram | def get_histogram(self, prefix: str) -> list[tuple[int, int]]:
rows = []
for k, v in self._data.items():
match = re.match(f"{prefix}\\[([0-9]+)\\]", k)
if match is not None:
entry = int(match.groups()[0])
rows.append((entry, v))
rows.sort()... | python | Tools/scripts/summarize_stats.py | 542 | 550 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,464 | get_rare_events | def get_rare_events(self) -> list[tuple[str, int]]:
prefix = "Rare event "
return [
(key[len(prefix) + 1 : -1].replace("_", " "), val)
for key, val in self._data.items()
if key.startswith(prefix)
] | python | Tools/scripts/summarize_stats.py | 552 | 558 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,465 | __init__ | def __init__(
self,
column_names: Columns,
calc_rows: RowCalculator,
join_mode: JoinMode = JoinMode.SIMPLE,
):
self.columns = column_names
self.calc_rows = calc_rows
self.join_mode = join_mode | python | Tools/scripts/summarize_stats.py | 581 | 589 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,466 | join_row | def join_row(self, key: str, row_a: tuple, row_b: tuple) -> tuple:
match self.join_mode:
case JoinMode.SIMPLE:
return (key, *row_a, *row_b)
case JoinMode.CHANGE | JoinMode.CHANGE_NO_SORT:
return (key, *row_a, *row_b, DiffRatio(row_a[0], row_b[0]))
... | python | Tools/scripts/summarize_stats.py | 591 | 598 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,467 | join_columns | def join_columns(self, columns: Columns) -> Columns:
match self.join_mode:
case JoinMode.SIMPLE:
return (
columns[0],
*("Base " + x for x in columns[1:]),
*("Head " + x for x in columns[1:]),
)
ca... | python | Tools/scripts/summarize_stats.py | 600 | 620 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,468 | join_tables | def join_tables(self, rows_a: Rows, rows_b: Rows) -> tuple[Columns, Rows]:
ncols = len(self.columns)
default = ("",) * (ncols - 1)
data_a = {x[0]: x[1:] for x in rows_a}
data_b = {x[0]: x[1:] for x in rows_b}
if len(data_a) != len(rows_a) or len(data_b) != len(rows_b):
... | python | Tools/scripts/summarize_stats.py | 622 | 643 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,469 | get_table | def get_table(
self, base_stats: Stats, head_stats: Stats | None = None
) -> tuple[Columns, Rows]:
if head_stats is None:
rows = self.calc_rows(base_stats)
return self.columns, rows
else:
rows_a = self.calc_rows(base_stats)
rows_b = self.calc_r... | python | Tools/scripts/summarize_stats.py | 645 | 655 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,470 | __init__ | def __init__(
self,
title: str = "",
summary: str = "",
part_iter=None,
*,
comparative: bool = True,
doc: str = "",
):
self.title = title
if not summary:
self.summary = title.lower()
else:
self.summary = summary
... | python | Tools/scripts/summarize_stats.py | 663 | 688 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,471 | iter_parts | def iter_parts(base_stats: Stats, head_stats: Stats | None):
yield from part_iter | python | Tools/scripts/summarize_stats.py | 682 | 683 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,472 | calc_execution_count_table | def calc_execution_count_table(prefix: str) -> RowCalculator:
def calc(stats: Stats) -> Rows:
opcode_stats = stats.get_opcode_stats(prefix)
counts = opcode_stats.get_execution_counts()
total = opcode_stats.get_total_execution_count()
cumulative = 0
rows: Rows = []
for... | python | Tools/scripts/summarize_stats.py | 691 | 717 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,473 | calc | def calc(stats: Stats) -> Rows:
opcode_stats = stats.get_opcode_stats(prefix)
counts = opcode_stats.get_execution_counts()
total = opcode_stats.get_total_execution_count()
cumulative = 0
rows: Rows = []
for opcode, (count, miss) in sorted(
counts.items(), key=... | python | Tools/scripts/summarize_stats.py | 692 | 715 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,474 | execution_count_section | def execution_count_section() -> Section:
return Section(
"Execution counts",
"Execution counts for Tier 1 instructions.",
[
Table(
("Name", "Count:", "Self:", "Cumulative:", "Miss ratio:"),
calc_execution_count_table("opcode"),
joi... | python | Tools/scripts/summarize_stats.py | 720 | 736 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,475 | pair_count_section | def pair_count_section(prefix: str, title=None) -> Section:
def calc_pair_count_table(stats: Stats) -> Rows:
opcode_stats = stats.get_opcode_stats(prefix)
pair_counts = opcode_stats.get_pair_counts()
total = opcode_stats.get_total_execution_count()
cumulative = 0
rows: Rows ... | python | Tools/scripts/summarize_stats.py | 739 | 775 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,476 | calc_pair_count_table | def calc_pair_count_table(stats: Stats) -> Rows:
opcode_stats = stats.get_opcode_stats(prefix)
pair_counts = opcode_stats.get_pair_counts()
total = opcode_stats.get_total_execution_count()
cumulative = 0
rows: Rows = []
for (opcode_i, opcode_j), count in itertools.islice... | python | Tools/scripts/summarize_stats.py | 740 | 759 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,477 | pre_succ_pairs_section | def pre_succ_pairs_section() -> Section:
def iter_pre_succ_pairs_tables(base_stats: Stats, head_stats: Stats | None = None):
assert head_stats is None
opcode_stats = base_stats.get_opcode_stats("opcode")
for opcode in opcode_stats.get_opcode_names():
predecessors = opcode_stats... | python | Tools/scripts/summarize_stats.py | 778 | 824 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,478 | iter_pre_succ_pairs_tables | def iter_pre_succ_pairs_tables(base_stats: Stats, head_stats: Stats | None = None):
assert head_stats is None
opcode_stats = base_stats.get_opcode_stats("opcode")
for opcode in opcode_stats.get_opcode_names():
predecessors = opcode_stats.get_predecessors(opcode)
success... | python | Tools/scripts/summarize_stats.py | 779 | 813 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,479 | specialization_section | def specialization_section() -> Section:
def calc_specialization_table(opcode: str) -> RowCalculator:
def calc(stats: Stats) -> Rows:
DOCS = {
"deferred": 'Lists the number of "deferred" (i.e. not specialized) instructions executed.',
"hit": "Specialized instructi... | python | Tools/scripts/summarize_stats.py | 827 | 929 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,480 | calc_specialization_table | def calc_specialization_table(opcode: str) -> RowCalculator:
def calc(stats: Stats) -> Rows:
DOCS = {
"deferred": 'Lists the number of "deferred" (i.e. not specialized) instructions executed.',
"hit": "Specialized instructions that complete.",
"miss": ... | python | Tools/scripts/summarize_stats.py | 828 | 850 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,481 | calc | def calc(stats: Stats) -> Rows:
DOCS = {
"deferred": 'Lists the number of "deferred" (i.e. not specialized) instructions executed.',
"hit": "Specialized instructions that complete.",
"miss": "Specialized instructions that deopt.",
"deopt": "Spe... | python | Tools/scripts/summarize_stats.py | 829 | 848 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,482 | calc_specialization_success_failure_table | def calc_specialization_success_failure_table(name: str) -> RowCalculator:
def calc(stats: Stats) -> Rows:
values = stats.get_opcode_stats(
"opcode"
).get_specialization_success_failure(name)
total = sum(values.values())
if total:
r... | python | Tools/scripts/summarize_stats.py | 852 | 866 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,483 | calc | def calc(stats: Stats) -> Rows:
values = stats.get_opcode_stats(
"opcode"
).get_specialization_success_failure(name)
total = sum(values.values())
if total:
return [
(label.capitalize(), Count(val), Ratio(val, total))
... | python | Tools/scripts/summarize_stats.py | 853 | 864 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,484 | calc_specialization_failure_kind_table | def calc_specialization_failure_kind_table(name: str) -> RowCalculator:
def calc(stats: Stats) -> Rows:
opcode_stats = stats.get_opcode_stats("opcode")
failures = opcode_stats.get_specialization_failure_kinds(name)
total = opcode_stats.get_specialization_failure_total(name)
... | python | Tools/scripts/summarize_stats.py | 868 | 884 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,485 | calc | def calc(stats: Stats) -> Rows:
opcode_stats = stats.get_opcode_stats("opcode")
failures = opcode_stats.get_specialization_failure_kinds(name)
total = opcode_stats.get_specialization_failure_total(name)
return sorted(
[
(label, Count(v... | python | Tools/scripts/summarize_stats.py | 869 | 882 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,486 | iter_specialization_tables | def iter_specialization_tables(base_stats: Stats, head_stats: Stats | None = None):
opcode_base_stats = base_stats.get_opcode_stats("opcode")
names = opcode_base_stats.get_opcode_names()
if head_stats is not None:
opcode_head_stats = head_stats.get_opcode_stats("opcode")
... | python | Tools/scripts/summarize_stats.py | 886 | 923 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,487 | specialization_effectiveness_section | def specialization_effectiveness_section() -> Section:
def calc_specialization_effectiveness_table(stats: Stats) -> Rows:
opcode_stats = stats.get_opcode_stats("opcode")
total = opcode_stats.get_total_execution_count()
(
basic,
specialized_hits,
specializ... | python | Tools/scripts/summarize_stats.py | 932 | 1,043 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,488 | calc_specialization_effectiveness_table | def calc_specialization_effectiveness_table(stats: Stats) -> Rows:
opcode_stats = stats.get_opcode_stats("opcode")
total = opcode_stats.get_total_execution_count()
(
basic,
specialized_hits,
specialized_misses,
not_specialized,
) = opcode_... | python | Tools/scripts/summarize_stats.py | 933 | 977 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,489 | calc_deferred_by_table | def calc_deferred_by_table(stats: Stats) -> Rows:
opcode_stats = stats.get_opcode_stats("opcode")
deferred_counts = opcode_stats.get_deferred_counts()
total = sum(deferred_counts.values())
if total == 0:
return []
return [
(name, Count(value), Ratio(value... | python | Tools/scripts/summarize_stats.py | 979 | 991 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,490 | calc_misses_by_table | def calc_misses_by_table(stats: Stats) -> Rows:
opcode_stats = stats.get_opcode_stats("opcode")
misses_counts = opcode_stats.get_misses_counts()
total = sum(misses_counts.values())
if total == 0:
return []
return [
(name, Count(value), Ratio(value, total)... | python | Tools/scripts/summarize_stats.py | 993 | 1,005 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,491 | call_stats_section | def call_stats_section() -> Section:
def calc_call_stats_table(stats: Stats) -> Rows:
call_stats = stats.get_call_stats()
total = sum(v for k, v in call_stats.items() if "Calls to" in k)
return [
(key, Count(value), Ratio(value, total))
for key, value in call_stats.it... | python | Tools/scripts/summarize_stats.py | 1,046 | 1,072 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,492 | calc_call_stats_table | def calc_call_stats_table(stats: Stats) -> Rows:
call_stats = stats.get_call_stats()
total = sum(v for k, v in call_stats.items() if "Calls to" in k)
return [
(key, Count(value), Ratio(value, total))
for key, value in call_stats.items()
] | python | Tools/scripts/summarize_stats.py | 1,047 | 1,053 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,493 | object_stats_section | def object_stats_section() -> Section:
def calc_object_stats_table(stats: Stats) -> Rows:
object_stats = stats.get_object_stats()
return [
(label, Count(value), Ratio(value, den))
for label, (value, den) in object_stats.items()
]
return Section(
"Object s... | python | Tools/scripts/summarize_stats.py | 1,075 | 1,102 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,494 | calc_object_stats_table | def calc_object_stats_table(stats: Stats) -> Rows:
object_stats = stats.get_object_stats()
return [
(label, Count(value), Ratio(value, den))
for label, (value, den) in object_stats.items()
] | python | Tools/scripts/summarize_stats.py | 1,076 | 1,081 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,495 | gc_stats_section | def gc_stats_section() -> Section:
def calc_gc_stats(stats: Stats) -> Rows:
gc_stats = stats.get_gc_stats()
return [
(
Count(i),
Count(gen["collections"]),
Count(gen["objects collected"]),
Count(gen["object visits"]),
... | python | Tools/scripts/summarize_stats.py | 1,105 | 1,131 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,496 | calc_gc_stats | def calc_gc_stats(stats: Stats) -> Rows:
gc_stats = stats.get_gc_stats()
return [
(
Count(i),
Count(gen["collections"]),
Count(gen["objects collected"]),
Count(gen["object visits"]),
)
for (i, gen) in en... | python | Tools/scripts/summarize_stats.py | 1,106 | 1,117 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,497 | optimization_section | def optimization_section() -> Section:
def calc_optimization_table(stats: Stats) -> Rows:
optimization_stats = stats.get_optimization_stats()
return [
(
label,
Count(value),
Ratio(value, den, percentage=label != "Uops executed"),
... | python | Tools/scripts/summarize_stats.py | 1,134 | 1,257 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,498 | calc_optimization_table | def calc_optimization_table(stats: Stats) -> Rows:
optimization_stats = stats.get_optimization_stats()
return [
(
label,
Count(value),
Ratio(value, den, percentage=label != "Uops executed"),
)
for label, (value, den) in... | python | Tools/scripts/summarize_stats.py | 1,135 | 1,145 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,499 | calc_optimizer_table | def calc_optimizer_table(stats: Stats) -> Rows:
optimizer_stats = stats.get_optimizer_stats()
return [
(label, Count(value), Ratio(value, den))
for label, (value, den) in optimizer_stats.items()
] | python | Tools/scripts/summarize_stats.py | 1,147 | 1,153 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,500 | calc_histogram_table | def calc_histogram_table(key: str, den: str) -> RowCalculator:
def calc(stats: Stats) -> Rows:
histogram = stats.get_histogram(key)
denominator = stats.get(den)
rows: Rows = []
last_non_zero = 0
for k, v in histogram:
if v != 0:
... | python | Tools/scripts/summarize_stats.py | 1,155 | 1,176 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.