Subject: bug#63225: Compiling regexp patterns (and REGEXP_CACHE_SIZE in search.c)

From: Mattias Engdegård <[email-masked]>
Date: Mon, 8 May 2023 21:53:42 +0200

8 maj 2023 kl. 21.38 skrev Ihor Radchenko <[email-masked]>:

> Does this imply that simple regexps like
> 
> (looking-at-p (rx (seq bol (zero-or-more (any "\t ")) "#" (or " " eol))))
> 
> should better be implemented as the following?

Obviously this isn't practical or beneficial for any but the simplest patterns. Benchmark if you are concerned.
It is useful to know when (not) to use regexps.

> (I now start thinking that it might be more efficient to create a bunch
> or char tables and step over them to match "regexp", just like any
> finite automaton would)

I wish elisp were fast enough that we could do that in general.

> I really hope that I did not need to do all these workarounds specific to
> current implementation pitfalls of Emacs regexp compiler.

Some of them. We program for the system we have. Emacs is a very slowly moving target.

>> I would like that too, but changing that isn't easy.
> 
> I am sure that it is easy.

I didn't mean technically. Code is easy to write.

> It actually does nothing given that `org-property-re' does not contain
> letters. I will remove it.

It doesn't even matter what org-property-re contains because it isn't used with a changed case-fold-search (which is bound using let, not let*).