From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: very slow archive-mode Date: Thu, 13 Mar 2008 11:08:52 -0400 Message-ID: References: <200803122247.58553.pogonyshev@gmx.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1205420986 9155 80.91.229.12 (13 Mar 2008 15:09:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Mar 2008 15:09:46 +0000 (UTC) Cc: emacs-devel@gnu.org, pogonyshev@gmx.net To: Kenichi Handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 13 16:10:14 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 1JZp42-0002pT-8I for ged-emacs-devel@m.gmane.org; Thu, 13 Mar 2008 16:09:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZp3T-0000au-6r for ged-emacs-devel@m.gmane.org; Thu, 13 Mar 2008 11:09:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JZp3P-0000ap-Lq for emacs-devel@gnu.org; Thu, 13 Mar 2008 11:09:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JZp3O-0000aV-H9 for emacs-devel@gnu.org; Thu, 13 Mar 2008 11:09:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZp3O-0000aS-8W for emacs-devel@gnu.org; Thu, 13 Mar 2008 11:09:10 -0400 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JZp3N-00078e-P9 for emacs-devel@gnu.org; Thu, 13 Mar 2008 11:09:09 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 667572CF761; Thu, 13 Mar 2008 11:09:09 -0400 (EDT) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id F2EF23FE2; Thu, 13 Mar 2008 11:08:52 -0400 (EDT) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id DCBA46C9DC; Thu, 13 Mar 2008 11:08:52 -0400 (EDT) In-Reply-To: (Kenichi Handa's message of "Thu, 13 Mar 2008 16:51:34 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) 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:92414 Archived-At: >> > 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: Also, IIUC the 8-bit bytes that are not represented as a single byte and not only more numerous, but they also take up more space (they used to take up just 2 bytes but now they take up what 3? 4? 5 bytes?). For this reason, we should rewrite the set-buffer-multibyte to do things in two passes: either a first that computes the final size and allocates the destination and a second that does no re-allocation, or a first that converts into too-large a destination and a second that shrinks it back to a reasonable size. Stefan