emacs-devel
[Top][All Lists]
Advanced

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

Re: rx.el sexp regexp syntax


From: Stefan Monnier
Subject: Re: rx.el sexp regexp syntax
Date: Sun, 27 May 2018 16:23:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> It would be interesting to compare the performance.  This also means
>> that there would be no need for caching on behalf of the supporting
>> language.
>
> I will predict that an rx interpreter built in Lisp will be two orders
> of magnitude slower than the current regexp machine, where both the
> construction of an automaton, and the byte-code interpreter which runs
> it are written in C (and probably quite optimised C at that).

The lex.el package in GNU ELPA has a matcher written in Elisp.
Its performance is actually pretty good compared to Emacs's builtin
regexp engine.  But that's because lex.el builds a DFA, so the slow
evaluation of Elisp is compensated by a more efficient algorithm.
And of course, building the DFA takes a lot more time than the
regexp-compilation of regexp.c (both because of the language used and
the algorithm).


        Stefan




reply via email to

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