Skip to content

Commit 8c1ff63

Browse files
committed
Address CR
1 parent a9c6e4b commit 8c1ff63

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mypy/build.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3334,7 +3334,13 @@ def find_stale_sccs(
33343334
scc_str = " ".join(ascc.mod_ids)
33353335
if fresh:
33363336
manager.trace(f"Found {fresh_msg} SCC ({scc_str})")
3337-
scc = order_ascc_ex(graph, ascc)
3337+
# If there is at most one file with errors we can skip the ordering to save time.
3338+
mods_with_errors = [id for id in ascc.mod_ids if graph[id].error_lines]
3339+
if len(mods_with_errors) <= 1:
3340+
scc = mods_with_errors
3341+
else:
3342+
# Use exactly the same order as for stale SCCs for stability.
3343+
scc = order_ascc_ex(graph, ascc)
33383344
for id in scc:
33393345
if graph[id].error_lines:
33403346
manager.flush_errors(
@@ -3471,6 +3477,7 @@ def process_stale_scc(graph: Graph, ascc: SCC, manager: BuildManager) -> None:
34713477

34723478
if missing_sccs:
34733479
# Load missing SCCs from cache.
3480+
# TODO: speed-up ordering if this causes problems for large builds.
34743481
fresh_sccs_to_load = [
34753482
manager.scc_by_id[sid] for sid in manager.top_order if sid in missing_sccs
34763483
]

0 commit comments

Comments
 (0)