emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] proposal: defconst/defcustom org-tags-regexp


From: Carsten Dominik
Subject: Re: [Orgmode] proposal: defconst/defcustom org-tags-regexp
Date: Sun, 2 Sep 2007 09:30:44 +0200


On Sep 1, 2007, at 13:01, Adam Spiers wrote:
Ah, I was assuming that the elisp interpreter was intelligent enough
that if you did a concat of two or more constants, it would only build
the regexp the first time, similar to m//o in Perl.  Is that not the
case?  Or maybe it only performs this optimisation if you
byte-compile?  I found this in the elisp manual:

 -- Special Form: eval-when-compile body...
     This form marks BODY to be evaluated at compile time but not when
     the compiled program is loaded.  The result of evaluation by the
     compiler becomes a constant which appears in the compiled program.
     If you load the source file, rather than compiling it, BODY is
     evaluated normally.

     If you have a constant that needs some calculation to produce,
     `eval-when-compile' can do that at compile-time.  For example,

          (defvar my-regexp
            (eval-when-compile (regexp-opt '("aaa" "aba" "abb"))))

Maybe I should practice what I preach and use mercurial to start an
experimental branch to look at the impact on performance of doing this
refactoring :-)

I made some tests a while ago, and the impact was very small.

- Carsten





reply via email to

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