emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Angus M <anguscmelville@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: long code blocks making Org Mode very slow
Date: Tue, 14 Jul 2015 21:06:59 +0000 (UTC)	[thread overview]
Message-ID: <loom.20150714T225954-643@post.gmane.org> (raw)
In-Reply-To: 86bnfebk8c.fsf@example.com

Sebastien Vauban <sva-news@...> writes:

> 
> Angus M <anguscmelville@...> writes:
> > I'm trying to run a long Python code block (~4000 lines) in org mode.  The
> > code is sandwiched between:
> > #+begin_src python
> > <python code block>
> > #+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%
                    - #<lambda 0x1bd609a3>                       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%
    - #<compiled 0xf18aef>                                         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.

  reply	other threads:[~2015-07-14 21:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 18:15 long code blocks making Org Mode very slow Angus M
2015-07-14 19:41 ` Sebastien Vauban
2015-07-14 21:06   ` Angus M [this message]
2015-07-14 21:44 ` Nick Dokos
2015-07-14 23:39   ` Angus M
2015-07-15 12:22 ` Angus M
2015-07-17  1:10   ` Grant Rettke
2015-07-21 11:09     ` Angus M
2015-07-22  1:20       ` Grant Rettke
2015-07-22 10:09         ` Angus M
2015-07-22 12:41           ` Nick Dokos
2015-07-22 23:09             ` Grant Rettke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20150714T225954-643@post.gmane.org \
    --to=anguscmelville@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).