diff --git a/src/couch/src/couch_util.erl b/src/couch/src/couch_util.erl index e03a50e1d50..912c6dd8a30 100644 --- a/src/couch/src/couch_util.erl +++ b/src/couch/src/couch_util.erl @@ -523,24 +523,13 @@ verify(X, Y) when is_list(X) and is_list(Y) -> verify(_X, _Y) -> false. -% linear search is faster for small lists, length() is 0.5 ms for 100k list -reorder_results(Keys, SortedResults) when length(Keys) < 100 -> - [couch_util:get_value(Key, SortedResults) || Key <- Keys]; reorder_results(Keys, SortedResults) -> - KeyDict = dict:from_list(SortedResults), - [dict:fetch(Key, KeyDict) || Key <- Keys]. + Map = maps:from_list(SortedResults), + [maps:get(Key, Map) || Key <- Keys]. -reorder_results(Keys, SortedResults, Default) when length(Keys) < 100 -> - [couch_util:get_value(Key, SortedResults, Default) || Key <- Keys]; reorder_results(Keys, SortedResults, Default) -> - KeyDict = dict:from_list(SortedResults), - DefaultFunc = fun({Key, Dict}) -> - case dict:is_key(Key, Dict) of - true -> dict:fetch(Key, Dict); - false -> Default - end - end, - [DefaultFunc({Key, KeyDict}) || Key <- Keys]. + Map = maps:from_list(SortedResults), + [maps:get(Key, Map, Default) || Key <- Keys]. url_strip_password(Url) -> re:replace(