help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Package for data serialization?


From: Pascal Bourguignon
Subject: Re: Package for data serialization?
Date: Tue, 13 Jun 2006 15:37:35 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Ted Zlatanov <tzz@lifelogs.com> writes:

> On 13 Jun 2006, spamfilteraccount@gmail.com wrote:
>
>> Is there a package for de/serializing an arbitrary elisp data
>> structure, so that it can be read/written in binary format from/to
>> disk?
>>
>> I know about prin1 and co., but they create a printed representation
>> and I want binary for speed and size.
>
> To save space, just compress the resulting file.  It will probably do
> better for *arbitrary* data (if you know the data, for instance
> images, you can obviously do a better job because you know what can be
> thrown away).

For space, already the ASCII form will be more compact than the binary
one.

For example, with numbers, you have a lot of numbers that have 1, 2 or
3 digits.  That's already one less than the 32-bit you'd use for all
the numbers.  For cons cells, you'd need two pointers (or two OID):
64-bit  With "(" " . " and ")" you use only 5 bytes per cons cells
intead of 8, and even less when you use the compacted form for lists:
"(" " " ")", using only 1 + (number of elements) bytes. etc.


> I don't think the speed improvements will be worth the time you will
> spend on this :)  Perhaps the fact that there isn't such a system
> already indicates it's not worth the effort to build it.

The speed bottleneck will be the hard disk.  If you've got shorter
data, then you'll be faster.  We've seen that an ASCII representation
is shorter. If you compress it even shorter than a binary one.  So it
will be faster. 

Moreover, the ASCII representation will be portable, and is less work.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

ATTENTION: Despite any other listing of product contents found
herein, the consumer is advised that, in actuality, this product
consists of 99.9999999999% empty space.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]