[erlang-questions] lists:member efficiency
Sun Nov 25 17:55:02 CET 2007
2007/11/25, Andrew Arrow <oneone@REDACTED>:
> If the list has over 100,000 items would
> lists:member keep up okay?
This simple test can give you an idea:
Eshell V5.5.4 (abort with ^G)
1> L = lists:seq(1,100000).
This is a crude measure of the worst-case performance
of using lists:member/2 on a list of 100,000 elements -
namely hitting the last object in the list (well, the worst
case is actually when no object is found, but the difference
falls within the margin of error.)
Normally, you'd reckon that half this cost will be your
average cost, but YMMV.
More information about the erlang-questions