From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: very slow archive-mode Date: Thu, 13 Mar 2008 16:51:34 +0900 Message-ID: References: <200803122247.58553.pogonyshev@gmx.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1205394740 10107 80.91.229.12 (13 Mar 2008 07:52:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Mar 2008 07:52:20 +0000 (UTC) Cc: emacs-devel@gnu.org, pogonyshev@gmx.net To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 13 08:52:48 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JZiEs-0003LZ-Ca for ged-emacs-devel@m.gmane.org; Thu, 13 Mar 2008 08:52:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZiEJ-0002oc-I7 for ged-emacs-devel@m.gmane.org; Thu, 13 Mar 2008 03:51:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JZiEE-0002oH-CB for emacs-devel@gnu.org; Thu, 13 Mar 2008 03:51:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JZiEC-0002na-R2 for emacs-devel@gnu.org; Thu, 13 Mar 2008 03:51:53 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZiEC-0002nR-Hm for emacs-devel@gnu.org; Thu, 13 Mar 2008 03:51:52 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JZiEB-0004qI-Rg for emacs-devel@gnu.org; Thu, 13 Mar 2008 03:51:52 -0400 Original-Received: from mx1.aist.go.jp ([150.29.246.133]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JZiE9-0006yO-S5 for emacs-devel@gnu.org; Thu, 13 Mar 2008 03:51:50 -0400 Original-Received: from rqsmtp1.aist.go.jp (rqsmtp1.aist.go.jp [150.29.254.115]) by mx1.aist.go.jp with ESMTP id m2D7paBE025687; Thu, 13 Mar 2008 16:51:36 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp3.aist.go.jp by rqsmtp1.aist.go.jp with ESMTP id m2D7pZ3i021437; Thu, 13 Mar 2008 16:51:35 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp3.aist.go.jp with ESMTP id m2D7pYbf018235; Thu, 13 Mar 2008 16:51:34 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken.m17n.org with local (Exim 4.69) (envelope-from ) id 1JZiDu-0000BZ-LA; Thu, 13 Mar 2008 16:51:34 +0900 In-reply-to: (message from Stefan Monnier on Wed, 12 Mar 2008 17:30:49 -0400) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-detected-kernel: by mx20.gnu.org: Solaris 8 (1) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:92378 Archived-At: In article , Stefan Monnier writes: > > I regularly open Java source archive (JAR of several tens of megabytes) > > in Emacs. Recently I recompiled Emacs from CVS and noticed that process > > of opening and parsing archive had become times slower (didn't measure > > precisely, but I guess about 5--10x slowdown is there). Can anyone > > investigate the problem or just guess what changes caused it? I don't > > remember when I compiled Emacs previously, I guess it was a couple month > > old. > I reported a similar problem. I believe set-buffer-multibyte is *a lot* > slower now, and may even have a time complexity of O(N^2). I suspect so too. Now set-buffer-multibyte must convert more 8-bit bytes to mutlibyte forms and that results in more movement and increasing of the gap. This code: (let ((str (buffer-string))) (erase-buffer) (set-buffer-multibyte t) (decode-coding-string str 'no-conversion nil (current-buffer)))) runs much faster than set-buffer-multibyte. But then, I think it is better that we read archive files into a multibyte buffer from the start by no-conversion-multibyte. As I've just found a bug in handling no-conversion-multibyte, I'll fix it soon. After that, I am going to change auto-coding-alist to use no-conversion-multibyte for archive files, and adjust arc-mode and tar-mode. What do you think? --- Kenichi Handa handa@ni.aist.go.jp PS. Another idea is keep archive files in a unibyte buffer and have the file listing part in another multibyte buffer. More radical idea is to allow changing multibyteness only in the narrowed region.