From mboxrd@z Thu Jan 1 00:00:00 1970 From: Angus M Subject: Re: long code blocks making Org Mode very slow Date: Tue, 14 Jul 2015 21:06:59 +0000 (UTC) Message-ID: References: <86bnfebk8c.fsf@example.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZF7Pz-0000Lo-Nr for emacs-orgmode@gnu.org; Tue, 14 Jul 2015 17:07:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZF7Pu-0000dm-Kr for emacs-orgmode@gnu.org; Tue, 14 Jul 2015 17:07:11 -0400 Received: from plane.gmane.org ([80.91.229.3]:45217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZF7Pu-0000dd-9C for emacs-orgmode@gnu.org; Tue, 14 Jul 2015 17:07:06 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZF7Ps-0000Ev-W9 for emacs-orgmode@gnu.org; Tue, 14 Jul 2015 23:07:05 +0200 Received: from 5ac76cdb.bb.sky.com ([5ac76cdb.bb.sky.com]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jul 2015 23:07:04 +0200 Received: from anguscmelville by 5ac76cdb.bb.sky.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jul 2015 23:07:04 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Sebastien Vauban writes: > > Angus M writes: > > I'm trying to run a long Python code block (~4000 lines) in org mode. The > > code is sandwiched between: > > #+begin_src python > > > > #+end_src > > > > It runs fine, but org mode becomes incredibly slow - when typing text there > > is about a 10 second delay before the character appears on the screen. If I > > reduce the number of lines of code in the block there is a noticeable > > increase in speed. > > > > I am not using line numbers, and the delay is not ameliorated by turning off > > fontification. > > > > If I add a semi-colon before #+begin_src, to comment it off (get rid of src > > environment), then org mode returns to it's normal speed. > > The best thing to do, now, is run the profiler: > > M-x profiler-start > ... type one character (which takes 10 s to be rendered) > M-x profiler-report > > Best regards, > Seb > Many thanks. I've run the profiler, but am not quite sure what to make of the result (fully expanded): - ... 1199 99% - while 1194 98% - cond 1194 98% - setq 1194 98% - org-footnote-at-reference-p 1194 98% - if 1194 98% - save-excursion 1179 97% - org-footnote-in-valid-context-p 1179 97% - let 1179 97% - unwind-protect 1179 97% - progn 1179 97% - not 1179 97% - or 1179 97% - org-in-block-p 1177 97% - let 1177 97% - unwind-protect 1177 97% - progn 1177 97% - catch 1177 97% - let 1177 97% - mapc 1168 96% - # 1168 96% - let 1168 96% - if 1168 96% - org-between-regexps-p 1168 96% - let 1168 96% - unwind-protect 1168 96% - progn 1167 96% - let 1167 96% - or 672 55% - save-excursion 672 55% outline-next-heading 478 39% outline-previous-heading 193 15% - save-excursion 495 40% - and 495 40% - or 291 24% - org-at-regexp-p 1 0% - catch 1 0% - save-excursion 1 0% let 1 0% not 115 9% - save-excursion 9 0% outline-previous-heading 8 0% outline-next-heading 1 0% - org-in-verbatim-emphasis 2 0% - let 2 0% - unwind-protect 2 0% - progn 2 0% - and 2 0% - org-in-regexp 2 0% - catch 2 0% - let 2 0% - save-excursion 1 0% - beginning-of-line 1 0% - 1 0% - and 15 1% - org-footnote-in-valid-context-p 15 1% - let 15 1% - unwind-protect 15 1% - progn 15 1% - not 15 1% - or 15 1% - org-in-block-p 14 1% - let 14 1% - unwind-protect 14 1% - progn 14 1% - catch 14 1% - let 14 1% - save-excursion 14 1% outline-previous-heading 10 0% outline-next-heading 4 0% - org-in-verbatim-emphasis 1 0% - let 1 0% - unwind-protect 1 0% progn 1 0% Automatic GC 5 0% - redisplay_internal (C function) 10 0% - jit-lock-function 10 0% - jit-lock-fontify-now 10 0% - funcall 10 0% - # 10 0% - run-hook-with-args 10 0% - font-lock-fontify-region 10 0% - font-lock-default-fontify-region 10 0% - font-lock-fontify-keywords-region 9 0% - org-activate-plain-links 2 0% - let 2 0% - if 2 0% and 2 0% - font-lock-unfontify-region 1 0% - org-unfontify-region 1 0% let* 1 0% - command-execute 2 0% - call-interactively 2 0% - byte-code 2 0% - read-extended-command 2 0% - completing-read 2 0% - completing-read-default 2 0% read-from-minibuffer 1 0% It seems to checking for a footnote reference. Is this anything out of the ordinary? My text contains no footnotes. Any pointers in the right direction greatly appreciated. Thanks Angus M P.s. This problem still occurs with only the basic 'starter' org mode .emacs init file.