From: Eli Zaretskii <eliz@is.elta.co.il>
Cc: Richard Stallman <rms@gnu.org>, emacs-devel@gnu.org
Subject: Re: struct.el -- a package to encode/decode binary data
Date: Thu, 21 Mar 2002 16:56:31 +0200 (IST) [thread overview]
Message-ID: <Pine.SUN.3.91.1020321164353.11007C-100000@is> (raw)
In-Reply-To: <5xbsdigi7n.fsf@kfs2.cua.dk>
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 ;-)
Seriously, though: I think we should stop thinking about unibyte vs
multibyte strings, and instead think about them as, well, just strings.
The uni- vs multi-byteness is an implementation detail that should not
bother a Lisp programmer. (That it sometimes does is a sign of bugs
that need to be fixed, IMHO.)
Emacs 21 is perfectly capable of holding binary data in a multibyte
buffer, so there's no need to do this on the Lisp level. If Emacs
decides that a buffer needs to be switched to unibyte mode, it will do
so automatically.
> > 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?
If the string holds non-ASCII text, yes. But not in your case, where the
``string'' holds binary data, I think.
Also, I think the slow-down should be noticeable when you need to walk
many characters, like when you invoke substring with a large argument.
In your case, you take a small number of characters and then run some
Lisp on them (e.g. to convert them into a number), so I think the
slow-down will be negligible. But that's speculation: I didn't really do
any measurements, so some complication might be evading me.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2002-03-21 14:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.SUN.3.91.1020319133840.17982G-100000@is>
2002-03-19 14:34 ` struct.el -- a package to encode/decode binary data Kim F. Storm
2002-03-19 21:27 ` Thien-Thi Nguyen
2002-03-21 9:04 ` Richard Stallman
2002-03-21 11:15 ` Eli Zaretskii
2002-03-21 13:31 ` Kim F. Storm
2002-03-21 14:56 ` Eli Zaretskii [this message]
2002-03-21 15:36 ` Kim F. Storm
2002-03-21 16:58 ` Stefan Monnier
2002-03-21 19:45 ` Eli Zaretskii
2002-03-22 1:05 ` Stefan Monnier
2002-03-22 11:04 ` Eli Zaretskii
2002-03-22 0:37 ` Miles Bader
2002-03-23 2:35 ` Richard Stallman
2002-03-21 16:53 ` Stefan Monnier
2002-03-23 2:36 ` Richard Stallman
2002-03-22 1:30 Kenichi Handa
-- strict thread matches above, loose matches on Subject: below --
2002-03-22 1:25 Kenichi Handa
2002-03-22 1:27 ` Stefan Monnier
2002-03-18 23:12 Kim F. Storm
2002-03-19 0:25 ` Miles Bader
2002-03-19 7:02 ` Eli Zaretskii
2002-03-19 12:34 ` Stefan Monnier
2002-03-19 14:38 ` Eli Zaretskii
2002-03-19 14:33 ` Luke Gorrie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.SUN.3.91.1020321164353.11007C-100000@is \
--to=eliz@is.elta.co.il \
--cc=emacs-devel@gnu.org \
--cc=rms@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.