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

Joel Reymont joelr1@REDACTED
Mon Nov 14 08:55:43 CET 2011


Nothing wrong with reinventing the wheel yet again.

Why not do it using proplists and orddict, though?

The latter module, I think, is somewhat underappreciated.

---
Sent from my iPhone

On Nov 14, 2011, at 6:22 AM, Max Bourinov <bourinov@REDACTED> wrote:

So, if anybody interested I ended up with my own module that deals with
list of tuples. Each tuple is {atom(), term()} where the atom is a key and
term is a value. It provides me basic get-set value methods and some domain
specific stuff.  My module heavily uses lists module, so it was very easy
to implement. Seems to be most efficient solution.

Thank you everybody for you suggestions and advices!

Best regards,
Max




On Sat, Nov 12, 2011 at 1:23 PM, Ulf Wiger <ulf@REDACTED> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111114/98ac49fc/attachment.htm>


More information about the erlang-questions mailing list