String representation in erlang
Thu Sep 15 12:12:09 CEST 2005
On 13 Sep 2005, at 15:17, Joe Armstrong (AL/EAB) wrote:
> 2> size(term_to_binary(packer:packstring(S))).
> 3> size(term_to_binary(S)).
> You might need to compresses them on disk to save space but then
> you need
> real compression, like LZSS...
... and you get compression for free if you use term_to_binary/2:
2> size(term_to_binary(lists:duplicate(1000000,$A), [compressed])).
I use it to transport large chunks of data between distributed nodes
over a (slow) network, and it works beautifully. At the other end,
binary_to_term will automatically recognise the data as being in a
compressed format and just do the right thing.
More information about the erlang-questions