Author tim.peters
Recipients Dennis Sweeney, Zeturic, ammar2, josh.r, pmpp, serhiy.storchaka, tim.peters, vstinner
Date 2020-10-09.03:53:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602215627.97.0.76804330938.issue41972@roundup.psfhosted.org>
In-reply-to
Content
BTW, this initialization in the FASTSEARCH code appears to me to be a mistake:

    skip = mlast - 1;

That's "mistake" in the sense of "not quite what was intended, and so confusing", not in the sense of "leads to a wrong result".

I believe `skip` should be initialized to plain `mlast` instead.  Setting it to something smaller than that (like to `mlast - 1`) doesn't cause an error, but fails to exploit as much skipping as possible.

`mlast - 1` is the same value `skip` is set to if the following loop finds that the last character of the pattern is also the pattern's first character, but doesn't appear elsewhere in the pattern. It can be one larger if the last pattern character is unique in the pattern (which is the initial value of `skip` set by the line shown above).
History
Date User Action Args
2020-10-09 03:53:48tim.peterssetrecipients: + tim.peters, vstinner, pmpp, serhiy.storchaka, josh.r, ammar2, Dennis Sweeney, Zeturic
2020-10-09 03:53:47tim.peterssetmessageid: <1602215627.97.0.76804330938.issue41972@roundup.psfhosted.org>
2020-10-09 03:53:47tim.peterslinkissue41972 messages
2020-10-09 03:53:47tim.peterscreate