[erlang-questions] Store maps in ets/dets?
Thu Apr 10 18:33:38 CEST 2014
On 2014-04-10 18:14, Michael Loftis wrote:
> On Thu, Apr 10, 2014 at 2:09 AM, Jesper Louis Andersen
> <> wrote:
>> The semantics of maps is that of a persistent data type. ETS is ephemeral.
>> So the fit is not good. Furthermore, maps are living int he process heap and
>> thus, they are automatically garbage collected. ETS is manually collected in
>> contrast. So the fit is even worse.
> I think you might mean the opposite here....that maps is ephemeral and
> ETS is persistent (or can be persistent using DETS anyway)
I don't like the word ephemeral here =)
Persistent is used all over to describe Maps as immutable. Though if you
have a database background the meaning of "persistent" is of course
another. Describing ETS as persistent is stretching it a bit far.
Maps are copied on update (atleast the values are copied) i.e. Maps are
immutable and in some circles this is equivalent to persistent.
>> Maps currently has no order (based on maps:map/2 and maps:fold/3), which
>> means they can be implemented as HAMTs (like in Clojure) once they grow
>> large. This has very good runtime behaviour, while keeping the process
>> semantics intact. The other option is to give maps order, but then we can't
>> use digital searching techniques anymore and must resort to balanced search
>> trees, e.g., AVL or RB trees and friends.
>> The current representation is very memory efficient however. It will
>> probably be very good for small maps with a keyset that doesn't change.
>> On Thu, Apr 10, 2014 at 10:41 AM, Max Lapshin <> wrote:
>>> Maybe I have missed something and failed to google this info, but are
>>> there any plans to store maps in ets?
>>> erlang-questions mailing list
>> erlang-questions mailing list
More information about the erlang-questions