emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] add compiled regexp primitive lisp object


From: Ihor Radchenko
Subject: Re: [PATCH] add compiled regexp primitive lisp object
Date: Mon, 23 Dec 2024 16:33:49 +0000

Eli Zaretskii <eliz@gnu.org> writes:

>> > That's almost negligible, IMO.
>> 
>> It is 2 seconds extra in my tests.
>> Also, it is ~20% of all the time taken by regexp matching.
>> I would not call it negligible.
>
> I guess we have different ideas of "negligible".  2 seconds out of 20
> is a very small part, and optimization should consider the other 18
> seconds first.

I see your point.

> And please note that we are not talking about some simple algorithmic
> change which will slash the time by 10% -- that would be a no-brainer
> indeed, we are talking about introducing a completely new Lisp object
> into Emacs.  That must be justified by some tangible gains.

I did not want to complicate the topic even further in this thread, but
if more justification is necessary...

The other 18 seconds are largely regexp matching itself. If you look
into my discussion with Mattias Engdegård in bug#63225, it was dedicated
to working around various corner cases of Emacs regexp engine and
its inefficiencies. And we were only able to do that because Mattias is
very familiar with the internals.

Having compiler regexp object exposed to Elisp would open the
following extra opportunities:

1. They could be inspected from Elisp, and hopefully optimized
   better. For now, there is simply no way to detect which parts of
   regexps are slow and which are not.
2. They could maybe even be constructed from Elisp, opening
   opportunities for custom regexp compilers that can be tailored to
   specific application needs rather than having to stick to hard-coded
   generic tradeoffs Emacs has to do without knowing the purpose of a
   regexp.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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