@@ -979,12 +979,14 @@ defmodule Map do
979979 `fun` receives the key and value of each of the
980980 elements in the map as a key-value pair.
981981
982- `Map.filter/2` is faster than using `map |> Enum.filter(fun) |> Enum.into(%{})`,
983- as no intermediate list is being built.
984-
985982 See also `reject/2` which discards all elements where the
986983 function returns a truthy value.
987984
985+ > Note: if you find yourself doing multiple calls to `Map.map/2`
986+ > and `Map.filter/2` in a pipeline, it is likely more efficient
987+ > to use `Enum.map/2` and `Enum.filter/2` instead and convert to
988+ > a map at the end using `Map.new/1`.
989+
988990 ## Examples
989991
990992 iex> Map.filter(%{one: 1, two: 2, three: 3}, fn {_key, val} -> rem(val, 2) == 1 end)
@@ -1010,9 +1012,8 @@ defmodule Map do
10101012 end
10111013
10121014 @ doc """
1013- Returns map excluding the pairs from `map` for which `fun` returns a truthy value.
1014- `Map.reject/2` is faster than using `map |> Enum.reject(fun) |> Enum.into(%{})`,
1015- as no intermediate list is being built.
1015+ Returns map excluding the pairs from `map` for which `fun` returns
1016+ a truthy value.
10161017
10171018 See also `filter/2`.
10181019
@@ -1041,8 +1042,15 @@ defmodule Map do
10411042 end
10421043
10431044 @ doc """
1044- Maps the function `fun` over all key-value pairs in `map`, returning a map
1045- with all the values replaced with the result of the function.
1045+ Maps the function `fun` over all key-value pairs in `map`
1046+
1047+ It returns a map with all the values replaced with the result
1048+ of the function.
1049+
1050+ > Note: if you find yourself doing multiple calls to `Map.map/2`
1051+ > and `Map.filter/2` in a pipeline, it is likely more efficient
1052+ > to use `Enum.map/2` and `Enum.filter/2` instead and convert to
1053+ > a map at the end using `Map.new/1`.
10461054
10471055 ## Examples
10481056
0 commit comments