From: Carsten Dominik <dominik@science.uva.nl>
To: Eddward DeVilla <eddward@gmail.com>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: proposal: defconst/defcustom org-tags-regexp
Date: Thu, 19 Jul 2007 17:08:48 +0200 [thread overview]
Message-ID: <20ed9633cd33f9824fae1ae6c47c9159@science.uva.nl> (raw)
In-Reply-To: <b71b18520707190608y7bee6ed4jbfbbc2f83cca9489@mail.gmail.com>
On Jul 19, 2007, at 15:08, Eddward DeVilla wrote:
> On 7/18/07, Carsten Dominik <dominik@science.uva.nl> wrote:
>> Do you know a solution for this problem?
>
> Does emacs let you manually compile a regular expression? If so, it
> might be possible to recompile REs when ever they change.
This is not the issue. Yes, Emacs compiles regular expressions
whenever necessary. However, consider the following loop:
(while (re-search-forward "^aaa" nil t)
(do-something)
In this case, Emacs will compile the regexp once and then use
it potentially many times.
However, in the following case:
(while (re-search-forward (concat "^" some-variable) nil t)
(do-something)
The regular expression wil be re-compiled all the time.
In this case you can work around it by doing:
(let ((re (concat "^" some-variable)))
(while (re-search-forward re nil t)
(do-something...))
But if the loop is calling functions, and the regular expression
is being built and used in those functions, this might slow down
things.
Now, I am not sure how slow actually, I am basically following the
arguments in Jeffrey E. F. Friedl's excellent book
"Mastering Regular Expressions", but I am not sure how large the
effect will be in the end. I remember that in perl this was
significant,
so I am assuming it is in Emacs.
I would like to factor out more regexps into variables, and may do
so with time - but this does not have priority.
- Carsten
--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477
next prev parent reply other threads:[~2007-07-19 15:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-16 13:21 proposal: defconst/defcustom org-tags-regexp Adam Spiers
2007-07-18 21:24 ` Carsten Dominik
2007-07-19 13:08 ` Eddward DeVilla
2007-07-19 15:08 ` Carsten Dominik [this message]
2007-07-19 16:14 ` Eddward DeVilla
2007-07-20 15:05 ` Adam Spiers
[not found] ` <931245f7aaa24436377e537552f1beab@science.uva.nl>
2007-09-01 11:01 ` Adam Spiers
2007-09-02 7:30 ` Carsten Dominik
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=20ed9633cd33f9824fae1ae6c47c9159@science.uva.nl \
--to=dominik@science.uva.nl \
--cc=eddward@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).