From: Jesper Harder <harder@myrealbox.com>
Subject: Re: decode-coding-string and consing
Date: Tue, 11 Feb 2003 18:26:36 +0100 [thread overview]
Message-ID: <m33cmuohir.fsf@defun.localdomain> (raw)
In-Reply-To: mailman.1774.1044945196.21513.help-gnu-emacs@gnu.org
Eli Zaretskii <eliz@is.elta.co.il> writes:
> On Mon, 10 Feb 2003, Jesper Harder wrote:
>
>> > If CODING-SYSTEM is nil or such that no encoding is necessary at
>> > all.
>>
>> But I don't understand why any encoding is needed at all in:
>>
>> (decode-coding-string "abc" 'us-ascii t)
>
> Why did you use us-ascii at all here?
It's just as an example where it's obvious that no encoding is needed.
What I'm really interested in is:
(decode-coding-string "abc" 'latin-1 t)
i.e. decoding a pure ASCII string as latin-1 (or another strict superset
of ASCII).
This pseudo-code for what I'd like to do efficiently:
,----
| (defun my-decode-coding-string (string coding-system nocopy)
| (if (and nocopy
| (STRING has no 8bit chars)
| (CODING-SYSTEM is a superset of ascii))
| string
| (decode-coding-string string coding-system nocopy)))
`----
> Anyway, is there some real problem behind this discussion?
Yes. Gnus conses excessively.
If `decode-coding-string' was a bit more clever about not consing a
string when it's not strictly necessary, we could cons ~ 2*N less
strings when constructing a summary buffer (N = number of articles).
It's also an issue when constructing a server buffer, where N is usually
large -- i.e. ~ 50.000-100.000 unnecessary strings are consed.
next parent reply other threads:[~2003-02-11 17:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1774.1044945196.21513.help-gnu-emacs@gnu.org>
2003-02-11 17:26 ` Jesper Harder [this message]
2003-02-10 16:47 decode-coding-string and consing Jesper Harder
2003-02-10 20:01 ` Eli Zaretskii
[not found] ` <mailman.1748.1044907500.21513.help-gnu-emacs@gnu.org>
2003-02-10 21:53 ` Jesper Harder
2003-02-11 6:32 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m33cmuohir.fsf@defun.localdomain \
--to=harder@myrealbox.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).