[erlang-questions] optimizing mnesia record size

Ulf Wiger ulf@REDACTED
Sun Apr 13 11:20:15 CEST 2008


You might try this one:

Eshell V5.5.4  (abort with ^G)
1> erts_debug:flat_size(lists:seq(1,100)).
200

(It will actually tell you how big the term will be once it has
been "flattened" during copying.)

BR,
Ulf W

2008/4/11, Paul Mineiro <paul-trapexit@REDACTED>:
> hi.
>
>  i'm trying to decrease the memory footprint of an mnesia database.  i
>  turned some strings into binaries and got some space savings.  past this,
>  i'm sure how to proceed.
>
>  one thing that would help is, is there a way to compute what the record
>  size will be (maybe within a constant factor?).  i've been playing around
>  at the shell calling size/1 on erlang:term_to_binary/1 but i'm not even
>  sure this is indicative.
>
>  also, are there some guidelines?  i was a bit surprised to discover that
>  replacing an atom with binary_to_list/1 composed with list_to_atom/1
>  actually made things bigger (by previous paragraph's metric). i was also
>  surprised to discover that really short strings are actually better as
>  lists rather than binaries.
>
>  any pointers would be greatly appreciated.
>
>  thanks,
>
>  -- p
>
>  In an artificial world, only extremists live naturally.
>
>         -- Paul Graham
>  _______________________________________________
>  erlang-questions mailing list
>  erlang-questions@REDACTED
>  http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list