()
| 148 | |
| 149 | |
| 150 | def main() -> None: |
| 151 | json_chunks = list(get_files(ROOT)) |
| 152 | class_chunks = list(extract_classes(json_chunks)) |
| 153 | |
| 154 | total_size = sum(chunk.total_size for chunk in json_chunks) |
| 155 | print(f"Total cache size: {total_size / (1024 * 1024):.3f} megabytes") |
| 156 | print() |
| 157 | |
| 158 | class_name_counter = Counter(chunk[".class"] for chunk in class_chunks) |
| 159 | print("Most commonly used classes:") |
| 160 | report_counter(class_name_counter) |
| 161 | |
| 162 | print("Most common literal chunks:") |
| 163 | report_most_common(class_chunks, 15) |
| 164 | |
| 165 | build = None |
| 166 | for chunk in json_chunks: |
| 167 | if "build.*.json" in chunk.filename: |
| 168 | build = chunk |
| 169 | break |
| 170 | assert build is not None |
| 171 | original = json.dumps(build.data, sort_keys=True) |
| 172 | print(f"Size of build.data.json, in kilobytes: {len(original) / 1024:.3f}") |
| 173 | |
| 174 | build.data = compress(build.data) |
| 175 | compressed = json.dumps(build.data, sort_keys=True) |
| 176 | print(f"Size of compressed build.data.json, in kilobytes: {len(compressed) / 1024:.3f}") |
| 177 | |
| 178 | build.data = decompress(build.data) |
| 179 | decompressed = json.dumps(build.data, sort_keys=True) |
| 180 | print(f"Size of decompressed build.data.json, in kilobytes: {len(decompressed) / 1024:.3f}") |
| 181 | |
| 182 | print("Lossless conversion back", original == decompressed) |
| 183 | |
| 184 | """var_chunks = list(pluck("Var", class_chunks)) |
| 185 | report_most_common(var_chunks, 20) |
| 186 | print() |
| 187 | |
| 188 | #for var in var_chunks: |
| 189 | # if var['fullname'] == 'self' and not (isinstance(var['type'], dict) and var['type']['.class'] == 'AnyType'): |
| 190 | # print(var) |
| 191 | #argument_chunks = list(pluck("Argument", class_chunks)) |
| 192 | |
| 193 | symbol_table_node_chunks = list(pluck("SymbolTableNode", class_chunks)) |
| 194 | report_most_common(symbol_table_node_chunks, 20) |
| 195 | |
| 196 | print() |
| 197 | print("Most common") |
| 198 | report_most_common(class_chunks, 20) |
| 199 | print()""" |
| 200 | |
| 201 | |
| 202 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…