emacs-devel
[Top][All Lists]
Advanced

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

regular expressions that match nothing


From: philippe schnoebelen
Subject: regular expressions that match nothing
Date: Tue, 14 May 2019 09:25:59 +0200

I was very happy to see that in v27.0.50 (regexp-opt nil) now properly returns a regular _expression_ that matches nothing, namely a\`. Thanks to whoever fixed that old bug.

I was wondering why (regexp-opt nil) uses a\` and not \'a or another option like \=a\= so I did some profiling (see attached code).

The different options that I tried have more or less the same response time when one checks, via looking-at, whether the regexp matches at point. But when one searches for a match across a whole buffer, some options behave notably faster than the others. And a\` is not the best, e.g., \=a\= is way faster. Maybe some other solutions would be even faster.

Of course this may be dependent on the internals of the specific regexp library at hand. I do not know enough to judge. In fact I believe that a solid regular _expression_ library should provide a specific regular _expression_ that matches nothing with special but easy treatment that guarantees best response time.

--phs

Attachment: profile-empty-regexp.el
Description: Binary data


reply via email to

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