Skip to content

Commit 38dcc45

Browse files
authored
Optimise Map.take/2 for empty list of keys (#15110)
1 parent 34fda89 commit 38dcc45

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/elixir/lib/map.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,8 @@ defmodule Map do
547547
:erlang.error({:badmap, non_map})
548548
end
549549

550+
defp take([], _map, []), do: %{}
551+
550552
defp take([], _map, acc) do
551553
:maps.from_list(acc)
552554
end

0 commit comments

Comments
 (0)