Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Oct 4, 2024
1 parent c09d2a3 commit c64907d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions mypy_primer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,19 @@ async def inner(project: Project) -> tuple[float, Project]:
result = await project.run_typechecker(type_checker_exe, typeshed_dir=None)
return (result.runtime, project)

projects = select_projects()
results = []
for fut in asyncio.as_completed([inner(project) for project in projects]):
time_taken, project = await fut
results.append((time_taken, project))
print(f"[{len(results)}/{len(projects)}] {time_taken:6.2f}s {project.location}")
import collections, statistics, random

results.sort(reverse=True)
projects = select_projects()
results = collections.defaultdict(list)
for _ in range(5):
random.shuffle(projects)
for i, fut in enumerate(asyncio.as_completed([inner(project) for project in projects])):
time_taken, project = await fut
results[project].append(time_taken)
print(f"[{i}/{len(projects)}] {time_taken:6.2f}s {project.location}")

results = [(statistics.mean(times), project) for project, times in results.items()]
results.sort(key=lambda x: x[0], reverse=True)
print("\n" * 5)
print("Results:")
for time_taken, project in results:
Expand Down

0 comments on commit c64907d

Please sign in to comment.