From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: rx.el sexp regexp syntax Date: Sun, 27 May 2018 16:23:07 -0400 Message-ID: References: <87h8mw3yoc.fsf@gmail.com> <20180525155126.GA4096@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1527452483 12212 195.159.176.226 (27 May 2018 20:21:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 27 May 2018 20:21:23 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 27 22:21:19 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fN2AH-0002zw-OH for ged-emacs-devel@m.gmane.org; Sun, 27 May 2018 22:21:17 +0200 Original-Received: from localhost ([::1]:53158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fN2CN-0003X0-6M for ged-emacs-devel@m.gmane.org; Sun, 27 May 2018 16:23:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fN2CH-0003We-81 for emacs-devel@gnu.org; Sun, 27 May 2018 16:23:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fN2CC-0003rF-9e for emacs-devel@gnu.org; Sun, 27 May 2018 16:23:21 -0400 Original-Received: from [195.159.176.226] (port=58023 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fN2CB-0003qM-ER for emacs-devel@gnu.org; Sun, 27 May 2018 16:23:16 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fN2A1-0002k7-Tx for emacs-devel@gnu.org; Sun, 27 May 2018 22:21:01 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 19 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:Xa/FUDtHkGe6Gs7/JyTfRcnT45k= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225771 Archived-At: >> 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