Skip to content

Commit 5824e9a

Browse files
authored
Optimize gather_keys/2 in Channel to avoid Enum.at/2 on maps (#4238)
1 parent c9e428b commit 5824e9a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/phoenix_live_view/channel.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,9 +826,9 @@ defmodule Phoenix.LiveView.Channel do
826826
defp maybe_merge_meta(value, _raw_payload), do: value
827827

828828
defp gather_keys(%{} = map, acc) do
829-
case Enum.at(map, 0) do
830-
{key, val} -> gather_keys(val, [key | acc])
831-
nil -> acc
829+
case :maps.next(:maps.iterator(map)) do
830+
{key, val, _iterator} -> gather_keys(val, [key | acc])
831+
:none -> acc
832832
end
833833
end
834834

0 commit comments

Comments
 (0)