From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: Package for data serialization? Date: Tue, 13 Jun 2006 15:37:35 +0200 Organization: Informatimago Message-ID: <878xo1yy5c.fsf@thalassa.informatimago.com> References: <1150195170.157848.7260@f6g2000cwb.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1150206073 31082 80.91.229.2 (13 Jun 2006 13:41:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 13 Jun 2006 13:41:13 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 13 15:41:09 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fq98a-0007mA-KF for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Jun 2006 15:40:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fq98a-000196-2O for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Jun 2006 09:40:56 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 44 Original-X-Trace: individual.net w9HVHv/o+VNtv9VcBwYbnAjk9GzXd5zZwvlgSPx8lBIy0i8sRa Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:11UkJyJlJj46srQWNMGnQWqFyeQ= Original-Xref: shelby.stanford.edu gnu.emacs.help:139804 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:35428 Archived-At: Ted Zlatanov 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.