[erlang-questions] ets vs list

Ulf Wiger ulf.wiger@REDACTED
Mon Sep 13 15:11:27 CEST 2010


On 09/13/2010 02:58 PM, Max Lapshin wrote:
> 
> My questions are:
> 1) are my conclusions right?
> 2) what ets is for, if list is fast enough on inserts? ets happened to
> be unusable in creating timeshift (storing large binaries) because of
> copy, it is much slower on extracting large amount of small objects.
> Where should I use it?

In your benchmark, you are doing full scans of the data set.
Lists are hard to beat then.

Ets tables are primarily good when you need random access, in which
case lists are pretty bad, with O(N) complexity. On the other hand,
for small sets, even lists can be quite competitive for random
access.

BR,
Ulf W


More information about the erlang-questions mailing list