summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2019-01-23 17:02:02 -0500
committerFred Hebert <mononcqc@ferd.ca>2019-01-23 17:02:02 -0500
commita0bf538f1821f24d6abc2f81bf0b812f4db5afbe (patch)
tree1bf36d4ec6845237acc68c953d7674a6fb4e793f
parent84cb7c3baa213d1a7e9af92379c59e38c1e282e6 (diff)
Fix performance regression in compiler
When the commit at https://github.com/erlang/rebar3/commit/8c4a74a3ed9ddd9841e6596ca86b81f3d43906c0 introduced a recursive search for build elements, it accidentally did so using a function that accepts a regex for its match. In doing so, if a behaviour or include had a name such as `common_prefix` and that multiple other modules used the name `common_prefix_<rest_of_name>`, all the other files would be seen as dependencies to be checked in a directed graph. This resulted in continuous re-checking of files that kept depending on each others and blew the compile time up exponentially. By using a delimitation on the regex (^<modulename>$), the build comes back down to finding only the right files and becomes fast again.
-rw-r--r--src/rebar_compiler_erl.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rebar_compiler_erl.erl b/src/rebar_compiler_erl.erl
index 0a560cd..759305c 100644
--- a/src/rebar_compiler_erl.erl
+++ b/src/rebar_compiler_erl.erl
@@ -317,7 +317,7 @@ expand_file_names(Files, Dirs) ->
true ->
[Incl];
false ->
- rebar_utils:find_files_in_dirs(Dirs, Incl, true)
+ rebar_utils:find_files_in_dirs(Dirs, [$^, Incl, $$], true)
end
end, Files).