You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "nickva (via GitHub)" <gi...@apache.org> on 2023/07/24 15:31:06 UTC

[GitHub] [couchdb] nickva commented on a diff in pull request #4659: fix(`mango`): remove duplicate elements from `indexable_fields/1` results

nickva commented on code in PR #4659:
URL: https://github.com/apache/couchdb/pull/4659#discussion_r1272427507


##########
src/couch/src/couch_util.erl:
##########
@@ -870,3 +871,19 @@ remove_sensitive_data(KVList) ->
     KVList1 = lists:keyreplace(<<"password">>, 1, KVList, {<<"password">>, <<"****">>}),
     % some KVList entries are atoms, so test fo this too
     lists:keyreplace(password, 1, KVList1, {password, <<"****">>}).
+
+% Alternative to `lists:uniq/1` until OTP 26 becomes the oldest
+% supported version.
+-spec nub(list()) -> list().
+nub(L) ->
+    nub_int(L, sets:new()).

Review Comment:
   Since we support OTP 24+ we can use a bit of a faster version of sets with `sets:new([{version, 2}]).`
   
   https://www.erlang.org/doc/man/sets.html
   
   It might not matter for indexable_fields as much but since it's in `couch_util` we might end up using some place where it might make a difference.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org