all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: "Miguel V. S. Frasson" <mvsfrasson@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Improving regexp-opt
Date: Wed, 17 Apr 2019 23:49:48 -0400	[thread overview]
Message-ID: <jwv8sw8dlh0.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAARdmY19=_i=d=NcHUjrR1X8uzVRpPE8TRYV_4vFNcueX57BUg@mail.gmail.com> (Miguel V. S. Frasson's message of "Wed, 17 Apr 2019 21:59:38 -0300")

>> Furthermore, even when the result is noticeably shorter, have you
>> compared the performance of the regexp-matcher?  I expect that you won't
>> be able to see a measurable difference there.
>
> For the very particular regexp for cXr, cXXr and cXXXr, the shorter
> "\\(?:c[ad]\\(?:[ad][ad]?\\)?r\\)" takes 40% of the time compared to the longer

Indeed, this is a case where the result is really better.  It's probably
a case where we shouldn't have started with the list of cXXr but should
have gone straight to generate "c[ad]\\(?:[ad][ad]?\\)?r" or
"c[ad]\\{1,3\\}r" without going through regexp-opt, but there could be
cases where we'd end up going through regexp-opt.

>> As I said, if you really want to improve on regexp-opt, you have to go
>> through a *real* DFA and that means not returning a regexp but a DFA, so
>> it's a completely different beast from `regexp-opt`.
>
> I don't understand what you mean by real DFA in emacs and how to
> implement that.

Emacs doesn't have any particular support for DFAs, currently, so you'd
have to code it up (that's what I did in lex.el, for example).


        Stefan



      reply	other threads:[~2019-04-18  3:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 16:41 Improving regexp-opt Miguel V. S. Frasson
2019-02-08  3:48 ` Stefan Monnier
2019-04-12 15:06   ` Miguel V. S. Frasson
2019-04-12 15:40     ` Miguel V. S. Frasson
2019-04-12 16:53     ` Stefan Monnier
2019-04-18  0:59       ` Miguel V. S. Frasson
2019-04-18  3:49         ` Stefan Monnier [this message]

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=jwv8sw8dlh0.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=mvsfrasson@gmail.com \
    /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.