all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Mendler <mail@daniel-mendler.de>
To: Philip Kaludercic <philipk@posteo.net>, emacs-devel@gnu.org
Subject: Re: [elpa] externals/compat 6a60af22da: Optimize string-search
Date: Fri, 11 Aug 2023 09:12:13 +0200	[thread overview]
Message-ID: <2904fc15-9d4b-448f-08c7-5d438e3f79ff@daniel-mendler.de> (raw)
In-Reply-To: <87jzu2jemz.fsf@posteo.net>



On 8/11/23 08:07, Philip Kaludercic wrote:
> ELPA Syncer <elpasync@gnu.org> writes:
> 
>> branch: externals/compat
>> commit 6a60af22da1f1a7b08457a4016b9412a475afe4a
>> Author: Daniel Mendler <mail@daniel-mendler.de>
>> Commit: Daniel Mendler <mail@daniel-mendler.de>
>>
>>     Optimize string-search
>> ---
>>  compat-28.el | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/compat-28.el b/compat-28.el
>> index fe69315522..b305ab2fff 100644
>> --- a/compat-28.el
>> +++ b/compat-28.el
>> @@ -52,9 +52,8 @@ issues are inherited."
>>    (when (and start-pos (or (< (length haystack) start-pos)
>>                             (< start-pos 0)))
>>      (signal 'args-out-of-range (list start-pos)))
>> -  (save-match-data
>> -    (let ((case-fold-search nil))
>> -      (string-match (regexp-quote needle) haystack start-pos))))
>> +  (let (case-fold-search)
>> +    (string-match-p (regexp-quote needle) haystack start-pos)))
>>  
>>  (compat-defun length= (sequence length) ;; [[compat-tests:length=]]
>>    "Returns non-nil if SEQUENCE has a length equal to LENGTH."
> 
> I don't believe this is a legal optimisation, even if the regular
> expression is quoted.  Consider

Hi Philip,

did you notice that I replaced `string-match' with `string-match-p'?

Daniel



  parent reply	other threads:[~2023-08-11  7:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <169158945793.6388.8459711282582712176@vcs2.savannah.gnu.org>
     [not found] ` <20230809135738.457BDC038BF@vcs2.savannah.gnu.org>
2023-08-11  6:07   ` [elpa] externals/compat 6a60af22da: Optimize string-search Philip Kaludercic
2023-08-11  6:23     ` Eli Zaretskii
2023-08-11  8:15       ` Philip Kaludercic
2023-08-11  7:12     ` Daniel Mendler [this message]
2023-08-11  8:17       ` Philip Kaludercic

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=2904fc15-9d4b-448f-08c7-5d438e3f79ff@daniel-mendler.de \
    --to=mail@daniel-mendler.de \
    --cc=emacs-devel@gnu.org \
    --cc=philipk@posteo.net \
    /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.