From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: struct.el -- a package to encode/decode binary data Date: 21 Mar 2002 14:31:56 +0100 Sender: emacs-devel-admin@gnu.org Message-ID: <5xbsdigi7n.fsf@kfs2.cua.dk> References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1016717608 32470 127.0.0.1 (21 Mar 2002 13:33:28 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 21 Mar 2002 13:33:28 +0000 (UTC) Cc: 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 16o2h6-0008Rb-00 for ; Thu, 21 Mar 2002 14:33:28 +0100 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16o2nK-00080L-00 for ; Thu, 21 Mar 2002 14:39:54 +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 16o2gq-0000Te-00; Thu, 21 Mar 2002 08:33:12 -0500 Original-Received: from mail.filanet.dk ([195.215.206.179]) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 16o2ei-0007nd-00; Thu, 21 Mar 2002 08:31:00 -0500 Original-Received: from kfs2.cua.dk.cua.dk (kfs2.local.filanet.dk [192.168.1.182]) by mail.filanet.dk (Postfix) with SMTP id 1F0DC7C035; Thu, 21 Mar 2002 13:30:59 +0000 (GMT) Original-To: Eli Zaretskii In-Reply-To: Original-Lines: 33 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50 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:2094 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:2094 Eli Zaretskii writes: > On Thu, 21 Mar 2002, Richard Stallman wrote: > > > Is there some specific reason not to use unibyte strings here? > > They are simply not needed here (AFAICS). On the surface, it looks "obvious" to use unibyte strings for data which is known to be - and processed as - byte-oriented data. But I guess you are right that it isn't strictly necessary even for byte-oriented data, so I will avoid the final conversion to unibyte -- if unibyte-ness is really needed, the caller can do the conversion. I've now changed the struct.el code to operate on a vector instead of a string, so in my case it really doesn't matter anymore. > 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 can see there is some caching in string_char_to_byte for multiple accesses to the same string, but it breaks as soon as you operate on more than one string e.g. in a loop. -- Kim F. Storm http://www.cua.dk _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel