[erlang-questions] Strings as Lists
Christian S
chsu79@REDACTED
Tue Feb 19 13:27:12 CET 2008
> I was afraid of the 8 bytes / character problem when I started my pet
> project. However, I keep the data inside mnesia, and I observed that
> mnesia seems to store strings in a compressed form, so I never bothered
> to add explicit to-binary conversion (... myself?)
Yes, when integers are smaller than 255 (a true string() type value)
then the list can (will?) be turned into a vector in the external
representation [1].
A guess is that it wouldn't be difficult to add a 16-bit vector
representation for an imaginary string16() type, but it would be a bit
more difficult to measure if it is worth it. Especially when binary
comprehensions makes it so easy to do something similar but
explicitly.
[1] : http://www.erlang.org/doc/apps/erts/erl_ext_dist.html#8.12
More information about the erlang-questions
mailing list