From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.help Subject: Re: decode-coding-string and consing Date: Tue, 11 Feb 2003 18:26:36 +0100 Organization: http://purl.org/harder/ Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1044987945 11997 80.91.224.249 (11 Feb 2003 18:25:45 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 11 Feb 2003 18:25:45 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18if6F-00037I-00 for ; Tue, 11 Feb 2003 19:25:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18if6H-0000od-04 for gnu-help-gnu-emacs@m.gmane.org; Tue, 11 Feb 2003 13:25:45 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!news.tele.dk!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: ^RrvqCr7c,P$zTR:QED"@h9+BTm-"fjZJJ-3=OU7.)i/K]<.J88}s>'Z_$r; List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:6564 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:6564 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.