From: Nick Dokos <nicholas.dokos@hp.com>
To: Bastien <bzg@altern.org>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Dramatic slowdown in org mode
Date: Tue, 18 Dec 2012 17:54:03 -0500 [thread overview]
Message-ID: <4668.1355871243@alphaville> (raw)
In-Reply-To: Message from Bastien <bzg@altern.org> of "Tue\, 18 Dec 2012 22\:53\:43 +0100." <87licv9gd4.fsf@bzg.ath.cx>
Bastien <bzg@altern.org> wrote:
> Hi Eric,
>
> "Fraga, Eric" <e.fraga@ucl.ac.uk> writes:
>
> > Unfortunately, I haven't had the chance to go through the changes over the
> > past week to see if I could identify which one causes the dramatic change
> > in performance.
>
> My guess is commit 980e522 -- can you confirm this?
>
I doubt it - this commit is not in the range that Eric identified (indirectly
in the filenames, so I'm guessing):
,----
| $ git log --oneline 47ea1666..76cf2538
| 76cf253 Merge branch 'maint'
| 7739e8b Small refactoring
| 0f3264f org-agenda.el: Use `org-todo-keyword-faces' to highlight selected TODO keywords.
| 0db5f28 org-html.el and org-e-html.el: Add CSS classes to list tags.
| bbb451a Merge branch 'maint'
| 374efdd org.el (org-in-fixed-width-region-p): Rewrite using org-element.el.
| 4996e5b Merge branch 'maint'
| 9d4dd69 org.el (org-fill-paragraph): Fill correctly in source code block.
| 1af0b39 Allow C-S-<up/down> to sync update clock timestamps by several units.
| 709bf92 Backwards compatibility for `user-error´
| 676180a org-e-texinfo.el: Fix link export to account for alternate TOC names
| 83b5679 org-export: Fix docstring
| 442b2ad Merge branch 'maint'
| 20839ce org-element: Fix parsing of a list in a block in a list
| 4588244 Revert "tangled files should not be writable"
| 457c27d org-e-confluence: Add asynchronous export support
| fa0e8fe org-test.el (org-test-with-temp-text-in-file): Wrap ,@body into (progn ...).
| c8452bf Merge branch 'maint'
| c0675b4 test-org-src.el: Fix a test.
| 8f3b8ee testing/org-test.el: Fix `org-test-with-temp-text'.
| e77f26e contrib/lisp/org-e-confluence.el: New file by Sébastien Delafond
| 20940bb contrib/lisp/org-bullets.el: New file by Evgeni Sabof
| db5881f Merge branch 'master' of orgmode.org:org-mode
| beea46f Merge branch 'maint'
| 0b44eb6 Add doclicense.texi to include the GNU FDL license and fix the copyright notice.
| e556812 org-export: Fix docstring
| 68d4de2 org-koma-letter: Add asynchronous export support
| a223d1a * contrib/lisp/org-e-texinfo.el: Remove messages used for debugging (org-e-texinfo--generate-menu-items): Remove messages used for debugging.
| 2dbd84e Merge branch 'maint'
| 6f5b4a8 orgguide.texi: Fix the copyright notice.
| 6af6e95 Merge branch 'maint'
| cd24962 org.texi: Update copyright notice.
| db51b80 Merge branch 'maint'
| df09917 org.el (org-edit-special): Fix bug about editing special environments.
| 81d5ebc org-src.el (org-edit-src-code): Check if we are in a source code block with `org-in-src-block-p'.
| a7afe7d org.el (org-in-src-block-p): Return t when on #+BEGIN|END_SRC lines.
| b866204 Merge branch 'maint'
| c4bf1ee Remove gplmanual.pl as we are not allowed to dual-license the Org manual.
| 6202df5 Merge branch 'master' of orgmode.org:org-mode
| 2c164be Merge branch 'maint'
| 4524a02 Edit source: fix 'end' initialisation
| 22e4a4e Revert "org-src.el (org-edit-src-code): Fix bug on Emacs <24.1."
| 286fd7f org-e-beamer/html: Asynchronous export ignores `org-export-show-temporary-export-buffer'
| 26d2490 Merge branch 'maint'
| 0584dff ob-exp.el (obe-marker): Delete useless var.
| ac1b117 Merge branch 'maint'
| 70b0f42 Fix copyright notices for test files.
| a0cb4a3 add tests for org-src-edit
| f72bb57 Merge branch 'master' of orgmode.org:org-mode
| 22ee29b Merge branch 'maint'
| 7a770c1 org-src.el (org-edit-src-code): Fix bug on Emacs <24.1.
| 06872a4 export back-ends: Activate asynchronous export
| 5319cec org-e-publish: Activate asynchronous publishing
| ffb630b org-export: Add asynchronous process wrapper for export
| 5c1eab5 * contrib/lisp/org-e-texinfo.el: Provided export of info: links
| 31d24aa Merge branch 'maint'
| 82db0aa org.texi: Fix typos.
| 8c04fb7 org-exp.el (org-export-copy-to-kill-ring): Add a new choice 'if-interactive and use it as the default.
| 627d573 org-e-html: Small refactoring
| 2c39a4a export back-ends: Apply line break changes
| 6e37a4d org-element: Fix line break parsing
| 8dd3fa3 Use the org-mime-default-header customized variable
| 2c34715 option to byte-compile elisp loaded from Org files
| 5e3b825 tangled files should not be writable
| ff00818 requiring ob now pulls in all of Babel
| 0694965 renaming lisp/ob.el to lisp/ob-core.el
| ba59eeb ob-python: specify defcustom parameters
| 01bf706 org-babel: fix bug introduced in commit 78cdf149
| cf9838f org.el: Display the blocking heading when a TODO state change is blocked.
| 1bfea39 Support `C-1' prefix for `org-agenda-capture' and `org-capture'.
| 275f07c Merge branch 'maint'
| 488eea6 org-latex.el: Escape raw path when exporting links to files.
`----
a7afe7d was my initial guess because of the profiles:
org-in-src-block-p 813 0.0134103450 1.649...e-05
org-in-src-block-p 813 28.441751922 0.0349837047
That's a whopping difference for such a simple function.
Abdo Roig-Maranges apparently did a bisect and came to the same conclusion.
A simple profiling exercise with the two versions of the function indicates a big difference but
as Abdo indicated as well, not as big as Eric finds:
--8<---------------cut here---------------start------------->8---
(defun org-in-src-block1-p (&optional inside)
"Whether point is in a code source block.
When INSIDE is non-nil, don't consider we are within a src block
when point is at #+BEGIN_SRC or #+END_SRC."
(let (ov)
(or (when (setq ov (overlays-at (point)))
(memq 'org-block-background
(overlay-properties
(car ov))))
(and (not inside)
(save-match-data
(save-excursion
(move-beginning-of-line 1)
(looking-at ".*#\\+\\(BEGIN\\|END\\)_SRC")))))))
(defun org-in-src-block2-p ()
"Whether point is in a code source block."
(let (ov)
(when (setq ov (overlays-at (point)))
(memq 'org-block-background
(overlay-properties
(car ov))))))
(defun my-test1 ()
(let ((n 1000))
(while (> n 0)
(org-in-src-block1-p)
(setq n (1- n)))))
(defun my-test2 ()
(let ((n 1000))
(while (> n 0)
(org-in-src-block2-p)
(setq n (1- n)))))
--8<---------------cut here---------------end--------------->8---
When executed on a begin_src line, my-test1 is 5x as slow as my-test2
in my setup. Otherwise the factor is about 2.
But Eric gets a factor of 2500 which is a bit of a mystery to me.
There might be additional factors entering in his case.
It's clear however that the regexp slows things down substantially.
BTW, do we really need the regexp to match anything before the
#+BEGIN_SRC, or just white space? If the latter is ok, it should speed
up the regexp matching.
Nick
next prev parent reply other threads:[~2012-12-18 22:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 21:05 Dramatic slowdown in org mode Fraga, Eric
2012-12-18 21:47 ` Abdó Roig-Maranges
2012-12-18 23:26 ` Bastien
2012-12-18 21:53 ` Bastien
2012-12-18 22:52 ` Abdó Roig-Maranges
2012-12-18 22:54 ` Nick Dokos [this message]
2012-12-18 23:26 ` Bastien
2012-12-19 6:25 ` Fraga, Eric
2012-12-19 9:42 ` Bastien
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4668.1355871243@alphaville \
--to=nicholas.dokos@hp.com \
--cc=bzg@altern.org \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.