all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Compiled regexp?
@ 2013-01-31 13:40 Bastien
  2013-01-31 14:08 ` Christopher Schmidt
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Bastien @ 2013-01-31 13:40 UTC (permalink / raw)
  To: emacs-devel; +Cc: Christopher Schmidt, Carsten Dominik

After Christopher submitted a patch for org-mode, Carsten and him
discussed the difference between these two patterns:

  ;; Concat in defconst
  (defconst my-pattern (concat "^" "xyz"))
  (re-search-forward my-pattern ...)

  ;; Concat in re-search-forward
  (defconst my-partial-pattern "xyz")
  (re-search-forward (concat "^" my-partial-pattern) ...)

Both Carsten and I thought there was some optimization done
by Emacs so that the first pattern is more efficient than the
second one.  (concat "^" "xyz") would be "cached", not eval'ed
each time you search for my-pattern.

Christopher pointed to compiled_pattern in the C part of Emacs,
suggesting that there would be no difference between the two
in terms of performance.

Can anyone confirm this is the case?

Thanks,

-- 
 Bastien




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

end of thread, other threads:[~2013-01-31 15:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-31 13:40 Compiled regexp? Bastien
2013-01-31 14:08 ` Christopher Schmidt
2013-01-31 14:11   ` Bastien
2013-01-31 14:26 ` Andreas Schwab
2013-01-31 14:42   ` Dominik, Carsten
2013-01-31 15:28 ` Stefan Monnier
2013-01-31 15:34   ` Dominik, Carsten
2013-01-31 15:55   ` Tom Tromey

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.