Browse Source

Fix performance regression in compiler

When the commit at
8c4a74a3ed
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.
pull/2001/head
Fred Hebert 6 years ago
parent
commit
a0bf538f18
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/rebar_compiler_erl.erl

+ 1
- 1
src/rebar_compiler_erl.erl View File

@ -317,7 +317,7 @@ expand_file_names(Files, Dirs) ->
true -> true ->
[Incl]; [Incl];
false -> false ->
rebar_utils:find_files_in_dirs(Dirs, Incl, true)
rebar_utils:find_files_in_dirs(Dirs, [$^, Incl, $$], true)
end end
end, Files). end, Files).

Loading…
Cancel
Save