[erlang-questions] RecordA serialization ... time ... deserialization to RecordB?

Ulf Wiger ulf@REDACTED
Sat Nov 12 11:23:06 CET 2011


An orddict will serialize nicely too, not least using 'sext', which will preserve the sort order. ;-)

BR,
Ulf W

12 nov 2011 kl. 10:50 skrev Joel Reymont <joelr1@REDACTED>:

> Don't serialize a dict.
> 
> Serialize a proplist, then use dict:from_list/1.
> 
> On Nov 12, 2011, at 9:22 AM, Max Bourinov wrote:
> 
>> Hello Erlangers!
>> 
>> So I made a dict as field of my state record and I do serialize it via term_to_binary and it seems to work like a charm.
>> 
>> One thing which makes me thinking about implementing my own serializer or dict like library - why dict data structure has many empty lists in it? Is it for the case of fast growing?
>> 
>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]
>> 
>> Eshell V5.8.5  (abort with ^G)
>> 1> D = dict:new().
>> {dict,0,16,16,8,80,48,
>>      {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
>>      {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}
>> 
>> Actually those empty lists doesn't hurt me much, but why? If nobody knows I will check sources :-)
> 
> --------------------------------------------------------------------------
> - for hire: mac osx device driver ninja, kernel extensions and usb drivers
> ---------------------+------------+---------------------------------------
> http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
> ---------------------+------------+---------------------------------------
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list