[erlang-questions] lists:member efficiency

Andrew Arrow oneone@REDACTED
Sun Nov 25 15:39:35 CET 2007


How efficient is the lists:member call?  If I have a large list of
integers where the order is important and I need to know if a specific
integer is in the list, should I maintain two separate data
structures?  One normal list where I keep appending new items onto the
head, and an ETS set with a key for each integer and the value "true"
just to know that integer is in the list.

So either I call ets:lookup on this separate hash, or lists:member on
the normal list.  If the list has over 100,000 items would
lists:member keep up okay?  Thanks.



More information about the erlang-questions mailing list