emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] long code blocks making Org Mode very slow


From: Angus M
Subject: Re: [O] long code blocks making Org Mode very slow
Date: Tue, 14 Jul 2015 21:06:59 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Sebastien Vauban <address@hidden> writes:

> 
> Angus M <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]