all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny McClanahan <dmcc2@hypnicjerk.ai>
To: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: prior work on non-backtracking regex engine?
Date: Sun, 10 Mar 2024 15:41:59 +0000	[thread overview]
Message-ID: <3a9IKoS2YLqJYosdfpFVdq8ashG0LPPJdB-ugdUgJEqM6-O3RWFeCu01FUPYBsp87xchkX-z1PRlNqJQm8ge_h3v0ziCWcME2fx-6PW-UP4=@hypnicjerk.ai> (raw)

Hello emacs-devel,

I've been learning a lot about regex implementations recently and was interested in learning:

(1) What kinds of inputs does the current emacs regex engine do poorly on?
  This "Regexp Problems" page is super helpful (https://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Problems.html), but I wanted to know if there was anywhere else e.g. in the source I should look for further notes on current performance TODOs? Is there a benchmark suite?

(2) What feature requirements does emacs impose of the regex engine?
  In particular, someone on the internet claimed (without citing any sources) several years ago (https://github.com/google/re2/issues/127#issuecomment-267676672) that the emacs regex engine needs the ability to search through non-contiguous text data to incorporate the gap buffer (which re2 along with many other engines do not support). When I recently asked the rust regex maintainer about this idea (https://github.com/rust-lang/regex/discussions/1167#discussioncomment-8585027), I found that emacs's ability to dynamically rebind word \< and symbol \_< boundaries according to mode is also unsupported by many general-purpose engines which e.g. only support Unicode word boundaries.

  I am also aware emacs supports backrefs in pattern strings, which cannot be implemented without some level of backtracking, but I am hoping this functionality can be implemented on top of an otherwise non-backtracking engine and retain the performance improvements.

(3) Have there been prior investigations of non-backtracking regex engines in emacs, or trying to use an external regex engine in general? What was the outcome, and does it seem like a useful research direction?

Thanks,
Danny



             reply	other threads:[~2024-03-10 15:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-10 15:41 Danny McClanahan [this message]
2024-03-12 23:45 ` prior work on non-backtracking regex engine? Danny McClanahan
2024-03-13 13:23   ` Ihor Radchenko
2024-04-07  4:42     ` Danny McClanahan
2024-04-07 14:15       ` Ihor Radchenko
2024-04-08 12:19       ` Helmut Eller
2024-04-08 13:13         ` Eli Zaretskii
2024-04-08 14:00       ` Po Lu
2024-04-08 14:23         ` Eli Zaretskii
2024-04-12  0:12           ` Danny McClanahan
2024-04-17 14:23 ` Clément Pit-Claudel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='3a9IKoS2YLqJYosdfpFVdq8ashG0LPPJdB-ugdUgJEqM6-O3RWFeCu01FUPYBsp87xchkX-z1PRlNqJQm8ge_h3v0ziCWcME2fx-6PW-UP4=@hypnicjerk.ai' \
    --to=dmcc2@hypnicjerk.ai \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.