[Top][All Lists]

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

Re: decode-coding-string and consing

From: Jesper Harder
Subject: Re: decode-coding-string and consing
Date: Tue, 11 Feb 2003 18:26:36 +0100
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50

Eli Zaretskii <> 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.

reply via email to

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