From cddb3fbd18bfe0e0d498cc2afa9f2ecb8d873da8 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Fri, 10 Apr 2020 23:37:24 +0000 Subject: [PATCH] Quick topsort optimizations - topsort of an app does a full analysis of all apps to come up with their app-level DAG - each extra_src_dir has its own analysis run - each extra_src_dir run is simulated as being an app - we therefore end up doing a lot of useless analysis for single app runs This patch notes runs with 1 or 0 apps and skips doing the topsort analysis on them, which speeds things up further. --- src/rebar_compiler_dag.erl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rebar_compiler_dag.erl b/src/rebar_compiler_dag.erl index cbecbda6..710cde89 100644 --- a/src/rebar_compiler_dag.erl +++ b/src/rebar_compiler_dag.erl @@ -169,6 +169,8 @@ propagate_stamps(G) -> %% @doc Return the reverse sorting order to get dep-free apps first. %% -- we would usually not need to consider the non-source files for the order to %% be complete, but using them doesn't hurt. +compile_order(_, AppDefs) when length(AppDefs) =< 1 -> + [Name || {Name, _Path} <- AppDefs]; compile_order(G, AppDefs) -> Edges = [{V1,V2} || E <- digraph:edges(G), {_,V1,V2,_} <- [digraph:edge(G, E)]],