From: "Miguel V. S. Frasson" <mvsfrasson@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Improving regexp-opt
Date: Wed, 17 Apr 2019 21:59:38 -0300 [thread overview]
Message-ID: <CAARdmY19=_i=d=NcHUjrR1X8uzVRpPE8TRYV_4vFNcueX57BUg@mail.gmail.com> (raw)
In-Reply-To: <jwvd0lrp3t8.fsf-monnier+emacs@gnu.org>
> 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
"\\(?:c\\(?:\\(?:a\\(?:a[ad]\\|d[ad]\\|[ad]\\)\\|d\\(?:a[ad]\\|d[ad]\\|[ad]\\)\\|[ad]\\)r\\)\\)"
But most of the time the match time is equivalent, and although I made an
improvement in the computation of regexp-opt with FA, it still has complexity
of greater order.
For the example for
'("cond" "if" "when" "unless" "while"
"let" "let*" "progn" "prog1" "prog2"
"save-restriction" "save-excursion" "save-window-excursion"
"save-current-buffer" "save-match-data"
"catch" "throw" "unwind-protect" "condition-case")
now it takes "just" 50 times of the computation time of current regexp-opt
(instead of 70 times that it took before).
So I admit that it has little benefit.
> IOW it's just not a good deal.
I agree.
> 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.
best regards.
Miguel.
--
Miguel Vinicius Santini Frasson
mvsfrasson@gmail.com
next prev parent reply other threads:[~2019-04-18 0:59 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 [this message]
2019-04-18 3:49 ` Stefan Monnier
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='CAARdmY19=_i=d=NcHUjrR1X8uzVRpPE8TRYV_4vFNcueX57BUg@mail.gmail.com' \
--to=mvsfrasson@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.