emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Regex Speedup for org-refresh-category-properties.
@ 2014-07-29  3:41 Malcolm Purvis
  2014-07-29 13:23 ` Bastien
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Malcolm Purvis @ 2014-07-29  3:41 UTC (permalink / raw)
  To: emacs-orgmode


I use the master version of org, and some months ago the time required
to generate my custom agenda view sky rocketed.  I've found that 90% of
the time was being spent in the call to re-search-forward in
org-refresh-category-properties.  The patch below speeds up the regular
expression search and makes the generation of my agenda as fast as
before.

Malcolm

diff --git a/lisp/org.el b/lisp/org.el
index 7e30061..2fc6854 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9474,7 +9474,7 @@ The refresh happens only for the current tree (not subtree)."
 	 (goto-char (point-min))
 	 (put-text-property (point) (point-max) 'org-category def-cat)
 	 (while (re-search-forward
-		 "^[ \t]*\\(#\\+CATEGORY:\\|[ \t]*:CATEGORY:\\)\\(.*\\)" nil t)
+		 "^[ \t]*\\(#\\+CATEGORY:\\|*:CATEGORY:\\)\\(.*\\)" nil t)
 	   (setq pos (match-end 0)
 		 optionp (equal (char-after (match-beginning 0)) ?#)
 		 cat (org-trim (match-string 2)))

-- 
	       Malcolm Purvis <malcolm@purvis.id.au>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Regex Speedup for org-refresh-category-properties.
  2014-07-29  3:41 Regex Speedup for org-refresh-category-properties Malcolm Purvis
@ 2014-07-29 13:23 ` Bastien
  2014-07-29 14:47 ` Nick Dokos
  2014-07-29 16:20 ` Achim Gratz
  2 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2014-07-29 13:23 UTC (permalink / raw)
  To: Malcolm Purvis; +Cc: emacs-orgmode

Hi Malcolm,

Malcolm Purvis <malcolm@purvis.id.au> writes:

> I use the master version of org, and some months ago the time required
> to generate my custom agenda view sky rocketed.  I've found that 90% of
> the time was being spent in the call to re-search-forward in
> org-refresh-category-properties.  The patch below speeds up the regular
> expression search and makes the generation of my agenda as fast as
> before.

Applied, thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Regex Speedup for org-refresh-category-properties.
  2014-07-29  3:41 Regex Speedup for org-refresh-category-properties Malcolm Purvis
  2014-07-29 13:23 ` Bastien
@ 2014-07-29 14:47 ` Nick Dokos
  2014-07-29 14:56   ` Bastien
  2014-07-29 16:20 ` Achim Gratz
  2 siblings, 1 reply; 8+ messages in thread
From: Nick Dokos @ 2014-07-29 14:47 UTC (permalink / raw)
  To: emacs-orgmode

Malcolm Purvis <malcolm@purvis.id.au> writes:

> I use the master version of org, and some months ago the time required
> to generate my custom agenda view sky rocketed.  I've found that 90% of
> the time was being spent in the call to re-search-forward in
> org-refresh-category-properties.  The patch below speeds up the regular
> expression search and makes the generation of my agenda as fast as
> before.
>
> Malcolm
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 7e30061..2fc6854 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -9474,7 +9474,7 @@ The refresh happens only for the current tree (not subtree)."
>  	 (goto-char (point-min))
>  	 (put-text-property (point) (point-max) 'org-category def-cat)
>  	 (while (re-search-forward
> -		 "^[ \t]*\\(#\\+CATEGORY:\\|[ \t]*:CATEGORY:\\)\\(.*\\)" nil t)
> +		 "^[ \t]*\\(#\\+CATEGORY:\\|*:CATEGORY:\\)\\(.*\\)" nil t)
                                            ^
                                            ^
                   What does the asterisk do?

Can you explain what this regexp is supposed to match?

Thanks,
Nick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Regex Speedup for org-refresh-category-properties.
  2014-07-29 14:47 ` Nick Dokos
@ 2014-07-29 14:56   ` Bastien
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2014-07-29 14:56 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Hi Nick,

Nick Dokos <ndokos@gmail.com> writes:

>                    What does the asterisk do?

I think this is simply a code typo, fixed in master.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Regex Speedup for org-refresh-category-properties.
  2014-07-29  3:41 Regex Speedup for org-refresh-category-properties Malcolm Purvis
  2014-07-29 13:23 ` Bastien
  2014-07-29 14:47 ` Nick Dokos
@ 2014-07-29 16:20 ` Achim Gratz
  2014-07-29 21:28   ` Bastien
  2014-07-29 23:46   ` Malcolm Purvis
  2 siblings, 2 replies; 8+ messages in thread
From: Achim Gratz @ 2014-07-29 16:20 UTC (permalink / raw)
  To: emacs-orgmode

Malcolm Purvis writes:
> I use the master version of org, and some months ago the time required
> to generate my custom agenda view sky rocketed.  I've found that 90% of
> the time was being spent in the call to re-search-forward in
> org-refresh-category-properties.  The patch below speeds up the regular
> expression search and makes the generation of my agenda as fast as
> before.

I agree that this is faster, but it doesn't look right.  Specifically I
don't think you are matching CATEGORY drawers any longer.

> -		 "^[ \t]*\\(#\\+CATEGORY:\\|[ \t]*:CATEGORY:\\)\\(.*\\)" nil t)
> +		 "^[ \t]*\\(#\\+CATEGORY:\\|*:CATEGORY:\\)\\(.*\\)" nil t)

I think that "^[ \t]*\\(\\(?:#\\+\\|:\\)CATEGORY:\\)\\(.*\\)" would be a
better regex, assuming that the original regex was doing the right thing.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf Blofeld V1.15B11:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Regex Speedup for org-refresh-category-properties.
  2014-07-29 16:20 ` Achim Gratz
@ 2014-07-29 21:28   ` Bastien
  2014-07-29 23:46   ` Malcolm Purvis
  1 sibling, 0 replies; 8+ messages in thread
From: Bastien @ 2014-07-29 21:28 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Achim Gratz <Stromeko@nexgo.de> writes:

> I think that "^[ \t]*\\(\\(?:#\\+\\|:\\)CATEGORY:\\)\\(.*\\)" would be a
> better regex, assuming that the original regex was doing the right thing.

Applied, thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Regex Speedup for org-refresh-category-properties.
  2014-07-29 16:20 ` Achim Gratz
  2014-07-29 21:28   ` Bastien
@ 2014-07-29 23:46   ` Malcolm Purvis
  2014-07-30  7:17     ` Achim Gratz
  1 sibling, 1 reply; 8+ messages in thread
From: Malcolm Purvis @ 2014-07-29 23:46 UTC (permalink / raw)
  To: emacs-orgmode

>>>>> "Achim" == Achim Gratz <Stromeko@nexgo.de> writes:

Achim> I think that "^[ \t]*\\(\\(?:#\\+\\|:\\)CATEGORY:\\)\\(.*\\)"
Achim> would be a better regex, assuming that the original regex was
Achim> doing the right thing.

Thanks.  Things are just as fast with this regexp.

Malcolm

-- 
	       Malcolm Purvis <malcolm@purvis.id.au>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Regex Speedup for org-refresh-category-properties.
  2014-07-29 23:46   ` Malcolm Purvis
@ 2014-07-30  7:17     ` Achim Gratz
  0 siblings, 0 replies; 8+ messages in thread
From: Achim Gratz @ 2014-07-30  7:17 UTC (permalink / raw)
  To: emacs-orgmode

Malcolm Purvis <malcolm <at> purvis.id.au> writes:
> Thanks.  Things are just as fast with this regexp.

Thanks for the confirmation.



Regards,
Achim.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-07-30  7:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-29  3:41 Regex Speedup for org-refresh-category-properties Malcolm Purvis
2014-07-29 13:23 ` Bastien
2014-07-29 14:47 ` Nick Dokos
2014-07-29 14:56   ` Bastien
2014-07-29 16:20 ` Achim Gratz
2014-07-29 21:28   ` Bastien
2014-07-29 23:46   ` Malcolm Purvis
2014-07-30  7:17     ` Achim Gratz

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).