[erlang-questions] ets vs list
Tue Sep 14 00:17:23 CEST 2010
On 09/13/2010 09:05 PM, Morten Krogh wrote:
>> No, there are several other overheads. For instance, you must somehow
>> implement a hash table from immutable dynamically typed data structures,
>> whereas in ETS (in C), you can use mutable arrays. The dict module,
>> for example, uses a tree structure of tuples. Once you've located
>> the leaf tuple where the object is to reside, you have to create
>> a new copy of that tuple, which means you must also update (copy)
>> the parent tuple, etc.
> But it is to some extent self imposed that you want a functional data
Sure. I'm not trying to criticize Erlang, but merely to point
out what makes ETS tables implemented in the VM faster than
an Emulation of them in Erlang code.
> You could have used the process dictionary for this or some foreign
> Nowadays nif, but that was not available to you then.
But in both cases (for Robert and for me), the whole _point_ was
to implement them in Erlang, since we wanted to get the functionality
in place without having to spend a lot of time with a native
implementation. The goal was not speed at all, but productivity.
More information about the erlang-questions