help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [External] : Re: Performance of `re-search-backward' vs `re-search-f


From: Stefan Monnier
Subject: Re: [External] : Re: Performance of `re-search-backward' vs `re-search-forward'
Date: Mon, 12 Apr 2021 17:03:19 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> So both basically move character by character and check if the regex
>> matches there (more or less)?
> They don't move character by character.
> They use the Boyer-Moore search algorithm.
> https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm

While this is true in the special case where your regexp only matches
a constant string (i.e. you could have used the non-re
`search-(for|back)ward` instead), it's a rare exception.  In the vast
majority of cases it does move character by character.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]