From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: struct.el -- a package to encode/decode binary data Date: Thu, 21 Mar 2002 11:53:59 -0500 Sender: emacs-devel-admin@gnu.org Message-ID: <200203211653.g2LGrxO17863@rum.cs.yale.edu> References: <5xbsdigi7n.fsf@kfs2.cua.dk> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1016729851 15298 127.0.0.1 (21 Mar 2002 16:57:31 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 21 Mar 2002 16:57:31 +0000 (UTC) Cc: Eli Zaretskii , Richard Stallman , emacs-devel@gnu.org Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16o5sZ-0003yd-00 for ; Thu, 21 Mar 2002 17:57:31 +0100 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16o5yr-000176-00 for ; Thu, 21 Mar 2002 18:04:01 +0100 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16o5sG-0000uI-00; Thu, 21 Mar 2002 11:57:12 -0500 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16o5pE-0000mO-00; Thu, 21 Mar 2002 11:54:04 -0500 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g2LGrxO17863; Thu, 21 Mar 2002 11:53:59 -0500 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: storm@cua.dk (Kim F. Storm) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:2099 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:2099 > On the surface, it looks "obvious" to use unibyte strings for > data which is known to be - and processed as - byte-oriented > data. Agreed. Unibyte strings are basically byte-arrays whereas multibyte-strings are char arrays. In your case you're dealing with bytes rather than with chars so it makes more sense (to me) to use unibyte strings. > > IMO, unibyte strings > > should not be used unless absolutely necessary, ideally never. > > Am I right in assuming that aref, aset, and substring are potentially > much slower on a multibyte string than on a unibyte string? Probably > not noticeable if you just look at a single char from a string, but > what if you loop over a string (forwards or backwards)? I think it's worse than that. `aset' on a multibyte string is very difficult to support in the case where you replace a char with another of a different byte-length: it ends up allocating a whole new string. This is really bad. I think `aset' on strings should simply be disallowed (I have it disabled here). Stefan _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel