Skip to content

Commit 76dfedb

Browse files
committed
Compile most recently changed files first
1 parent 8bec593 commit 76dfedb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/mix/lib/mix/compilers/elixir.ex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ defmodule Mix.Compilers.Elixir do
226226
dest
227227
)
228228

229+
# Now sort the files so the ones changed more recently come first.
230+
# We do an optimized version of sort_by since we don't care about
231+
# stable sorting.
232+
changed =
233+
changed
234+
|> Enum.map(&{-elem(Map.fetch!(sources_stats, &1), 0), &1})
235+
|> Enum.sort()
236+
|> Enum.map(&elem(&1, 1))
237+
229238
{modules, exports, changed, sources_stats}
230239
end
231240

0 commit comments

Comments
 (0)