[Top][All Lists]

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

Re: struct.el -- a package to encode/decode binary data

From: Kim F. Storm
Subject: Re: struct.el -- a package to encode/decode binary data
Date: 21 Mar 2002 16:36:42 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

Eli Zaretskii <address@hidden> writes:

> On 21 Mar 2002, Kim F. Storm 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.
> That's the C programmer in you trying to get free ;-)

Right on the spot :-)

> > Am I right in assuming that aref, aset, and substring are potentially
> > much slower on a multibyte string than on a unibyte string?

I just tried to measure whether there is any difference, by copying
between two strings like this:
  (let ((i (length a)))
    (while (> i 0)
      (setq i (1- i))
      (aset a i (aref b i))))

a and b are either both multibyte or both unibyte and initialized
to all NULs.  The difference in time is very small if there is any...

> If the string holds non-ASCII text, yes.  But not in your case, where the 
> ``string'' holds binary data, I think.

.. which confirms your belief.

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

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