From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#63225: Compiling regexp patterns (and REGEXP_CACHE_SIZE in search.c) Date: Mon, 8 May 2023 20:21:03 +0200 Message-ID: References: <63882A45-BD02-40D5-92FA-70175267BA3B@acm.org> <874jou7lsf.fsf@localhost> <37EED5F9-F1FE-46B6-B4FA-0B268B945123@gmail.com> <87wn1qqvj0.fsf@localhost> <34F4849A-CB39-4C96-9CC1-11ED723706DA@gmail.com> <87wn1psqny.fsf@localhost> <6DAF37F9-B236-4C33-8E30-0FCA47CCBCC5@gmail.com> <87zg6lfobh.fsf@localhost> <281B22C2-CD69-4495-A97C-E754446CA9A6@gmail.com> <87o7n1v1w3.fsf@localhost> <878E8D66-A548-42E6-B077-6068A8B131D8@gmail.com> <87ednvul22.fsf@localhost> <87y1m1oa01.fsf@localhost> <74CD5EF4-5424-40BA-8F80-D0FD89CB890F@gmail.com> <87zg6fjar6.fsf@localhost> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25213"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63225@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 08 20:22:10 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pw5Uv-0006Ke-RH for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 May 2023 20:22:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pw5Up-0006Eg-MJ; Mon, 08 May 2023 14:22:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pw5Uo-0006DU-6w for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 14:22:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pw5Un-0005Yw-UA for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 14:22:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pw5Un-0008Pm-On for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 14:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 May 2023 18:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63225 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63225-submit@debbugs.gnu.org id=B63225.168357007332276 (code B ref 63225); Mon, 08 May 2023 18:22:01 +0000 Original-Received: (at 63225) by debbugs.gnu.org; 8 May 2023 18:21:13 +0000 Original-Received: from localhost ([127.0.0.1]:41536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw5U1-0008OW-Bh for submit@debbugs.gnu.org; Mon, 08 May 2023 14:21:13 -0400 Original-Received: from mail-lf1-f53.google.com ([209.85.167.53]:61789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw5Tz-0008OG-Ks for 63225@debbugs.gnu.org; Mon, 08 May 2023 14:21:12 -0400 Original-Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-4f004cc54f4so5546650e87.3 for <63225@debbugs.gnu.org>; Mon, 08 May 2023 11:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683570065; x=1686162065; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=d3VjR8jpTDfNxLuMadQs8i6z7R7+ssbF1meYFj4BsTw=; b=qoC3r7YvbywzavMY9Kh8xBeZwoXaoZrg5W4R3CA56E7KCkKeCQQt9Bi0tWJ1nx7b+/ YPxG8NUwZdtMSVvBH44mWGtGVc2dy6/VwBDP867hqRN/OjZcXDxFCbN/W8tRm7MrE1JO rCqm3w5B025fa9c0lPj6ehok0G+utNJPxnn8y88NmBvQ6wAv61P0gviYYQhKPCEDx9w7 oVdvoBkw/GgyBRx0jSfflAgCiys6ExIE/qNtCQ7gcdsemXZKVvIelDWTe9yt7++m68k9 GiAaUOrh6naZ8CbLZ+bG1s9do/kkS0YfH4dJ2ekJBSVzeDE5kM9HpU4EXlm97nVkFRfQ dj3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683570065; x=1686162065; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=d3VjR8jpTDfNxLuMadQs8i6z7R7+ssbF1meYFj4BsTw=; b=UuxQ1CLjwjuS8lNwse/WNjnkTvgfpl2pvcQuR05NdVoNIdg0+SglAIWrKbSi21GZUQ ArZBNrpm32IBDnE7XCb6e0H/y/BQc8yfxssww2B9VvmhenAvezmyI0jh6bGTGyRe0yk1 QX0EM83ieN0l1q5YUBQ54Ou27MoUXo9/oSw7TC1dOpY5RPYYrVfAnbX+PjYlRKZf7U3T jVSulfzwEotUI2d3F+5z+zVkp7f/D9WWbnjoSX9YTWBq3A08eczqyD5qf7OkzUV9lAwZ ZbNPBwQ/8k382hd2j3fxYB8uG2+R17D5wE/rzaKu2rsjvycOXKJAHrYiIu/JmNiiAGzm pS8Q== X-Gm-Message-State: AC+VfDyU14q1TYD2ZKeEjnHqZ8ps+rIscWYCdvV05IdvIdkHAhWzLZQr CiVDddYdXnXSS+BpCObZ1pQ= X-Google-Smtp-Source: ACHHUZ6MC/dd2MXNcNpkLBmjZKuWX1O+yUo6/LPk/6qi+3jmVYRtvBTL4u5R5k2mk8fMQKwtlNC+Fg== X-Received: by 2002:a19:ee0c:0:b0:4dd:a61c:8f74 with SMTP id g12-20020a19ee0c000000b004dda61c8f74mr15845lfb.51.1683570065393; Mon, 08 May 2023 11:21:05 -0700 (PDT) Original-Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id c10-20020ac244aa000000b004f145c9b900sm61293lfm.254.2023.05.08.11.21.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2023 11:21:04 -0700 (PDT) In-Reply-To: <87zg6fjar6.fsf@localhost> X-Mailer: Apple Mail (2.3654.120.0.1.15) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261353 Archived-At: 8 maj 2023 kl. 13.58 skrev Ihor Radchenko : > (save-excursion > (beginning-of-line 0) > (not (looking-at-p "[[:blank:]]*$")))) I wonder if that last part isn't better written as (save-excursion (forward-line 0) ; faster than beginning-of-line (skip-chars-forward "[:blank:]") ; faster than looking-at-p (not (eolp))) ; very cheap which doesn't use regexps at all. Worth a try. But yes, I sort of understand what you are getting at (except the = business with the MODE parameter which is still a bit mysterious to me). > [now part of the giant rx] >=20 > (rx line-start (0+ (any ?\s ?\t)) > ":" (1+ (any ?- ?_ word)) ":" > (0+ (any ?\s ?\t)) line-end) Any reason you don't capture the part between the colons here, so that = you don't need to match it later on? > But why? Aren't (in word ?_ ?-) and (or word ?_ ?-) not the same? "[-_[:word:]]" and "\\w\\|[_-]" indeed match the same thing but they = don't generate the same regexp bytecode -- the former is faster. (In = this case rx makes a literal translation to those strings but we should = probably make it optimise to the faster regexp.) There is a regexp disassembler for the really curious but it doesn't = come with Emacs. > Your suggestions about using (not (in ...)) in place of (in ...) are > good, but I am afraid to break CJK cases where people can use = unexpected > set of characters. I was bitten by this in the past. In this case there's no need since you could gain some speed by the = simple rewrite (or -> in) above, but there may be others where = conditions are different. >> Maybe, but you still cons each time. (And remember that the plist-get = equality funarg is new in Emacs 29.) >=20 > Sure it does. > It is just one of the variable parts of Org syntax that might be > changed. There are ways to make this into constant, but it is a = fragile > area of the code that I do not want to touch without a reason. > (Especially given that I am not familiar with org-list.el) So it's fine to use elisp constructs new in Emacs 29 in Org? Then the = line ;; Package-Requires: ((emacs "26.1")) in org.el should probably be updated, right? > I hope we do. If only Emacs had a way to define `case-fold-search' = right > within the regexp itself. I would like that too, but changing that isn't easy. By the way, it seems that org-element-node-property-parser binds = case-fold-search without actually using it. Bug?