From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: proposal: defconst/defcustom org-tags-regexp Date: Sun, 2 Sep 2007 09:30:44 +0200 Message-ID: References: <20070716132118.GA28297@atlantic.linksys.moosehall> <56626b2502c1e0ead302243cb947b0b2@science.uva.nl> <20070720150513.GB28297@atlantic.linksys.moosehall> <931245f7aaa24436377e537552f1beab@science.uva.nl> <20070901110123.GA32102@atlantic.linksys.moosehall> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IRjuy-0006rk-Vd for emacs-orgmode@gnu.org; Sun, 02 Sep 2007 03:30:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IRjux-0006rE-Um for emacs-orgmode@gnu.org; Sun, 02 Sep 2007 03:30:48 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IRjux-0006rB-Ny for emacs-orgmode@gnu.org; Sun, 02 Sep 2007 03:30:47 -0400 Received: from korteweg.uva.nl ([146.50.98.70]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IRjux-0003US-Dm for emacs-orgmode@gnu.org; Sun, 02 Sep 2007 03:30:47 -0400 In-Reply-To: <20070901110123.GA32102@atlantic.linksys.moosehall> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Adam Spiers Cc: org-mode mailing list 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