From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Mitchell Subject: Re: Slow movement in large buffers Date: Tue, 15 Mar 2011 12:33:36 +0000 Message-ID: References: <87d3ltjc8x.fsf@fastmail.fm> <17242340-A14F-495A-B144-20C96D52B620@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=43023 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzTRj-0000kF-Ey for emacs-orgmode@gnu.org; Tue, 15 Mar 2011 08:33:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzTRh-0006Ld-N1 for emacs-orgmode@gnu.org; Tue, 15 Mar 2011 08:33:55 -0400 Received: from lo.gmane.org ([80.91.229.12]:40421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzTRh-0006LB-A7 for emacs-orgmode@gnu.org; Tue, 15 Mar 2011 08:33:53 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PzTRf-0001oP-97 for emacs-orgmode@gnu.org; Tue, 15 Mar 2011 13:33:51 +0100 Received: from e4300lm.epcc.ed.ac.uk ([129.215.63.156]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Mar 2011 13:33:51 +0100 Received: from wence by e4300lm.epcc.ed.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Mar 2011 13:33:51 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Carsten Dominik wrote: > On Mar 15, 2011, at 4:25 AM, Matt Lundin wrote: >> I've been navigating the org-issues file (14000+ lines) and have found >> movement within the file to be fairly slow. Sometimes Emacs will lock up >> for several seconds. >> For instance, to move from the level one heading "* Other" to "* Closed >> issues" when the outline is folded takes over three seconds: >> --8<---------------cut here---------------start------------->8--- >> next-line 1 3.015289 3.015289 >> --8<---------------cut here---------------end--------------->8--- > Wow, this is really bad. > Could you use elp and instrument org, outline, > and font-lock, and do that motion and report > the results? For me, all the time is spent in vertical-motion (which is C level, so I can't get a more detailed breakdown). >> In my experience, the maximum workable size of org files is around >> 10,000 lines. Beyond that, Emacs starts to spin its wheels. > Not good at all. I believe it is likely to be due to org's large use of overlays. Here's a quote from the elisp manual: | (elisp)Overlays | The visual effect of an overlay is the same as of the corresponding | text property .... However, due to a different | implementation, *overlays generally don't scale well* (many operations | take a time that is proportional to the number of overlays in the | buffer). If you need to affect the visual appearance of many portions | in the buffer, we recommend using text properties. Emphasis added. For example, in org-issues.org: M-: (loop for l in (overlay-lists) sum (length l)) RET => 3823 And vertical motion (with C-n, C-p) takes a long time. remove all the overlays M-: (remove-overlays) RET collapse the buffer again M-x org-shifttab RET Now vertical motion is rapid. This suggests that one should try and see if overlays in org buffers can be replaced by text properties. Which do not cause the same slowdown. Lawrence -- Lawrence Mitchell