10000 bpo-41972: Use the two-way algorithm for string searching by sweeneyde · Pull Request #22904 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-41972: Use the two-way algorithm for string searching #22904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Feb 28, 2021

Conversation

sweeneyde
Copy link
Member
@sweeneyde sweeneyde commented Oct 23, 2020

it has actually checked for matches, but didn't find any. callers
beware! */

/* If the needle is long enough, use Crochemore and Perrin's Two-Way
algorithm, which has guaranteed O(n) runtime. Also compute a table
of shifts to sometimes achieve O(n/m) runtime in the best cases. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the last two lines, suggest instead:

algorithm, which has worst-case O(n) runtime, and best case O(n/k). Also compute a table of shifts to achieve O(n/k) in more cases, and to often (data dependent) deduce larger shifts than pure C&P can deduce.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Dec 16, 2020
@sweeneyde
Copy link
Member Author

@github-actions I think this should stay open

@tim-one
Copy link
Member
tim-one commented Dec 16, 2020

Absolutely keep it open! I've been buried under other stuff, but am still keen to get this merged.

@Mariatta
Copy link
Member

We've configured it so that GitHub action doesn't close the PR, so don't worry. I will see about adjusting that message.

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Dec 17, 2020
@gvanrossum
Copy link
Member
gvanrossum commented Feb 27, 2021

If @tim-one approves we might get this into alpha 6 which goes out Monday. @pablogsal what do you think?

@tim-one tim-one self-requested a review February 27, 2021 22:52
Copy link
Member
@tim-one tim-one left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As briefly explained on BPO, I'd very much like to see this get in, but can't make the time needed for an in-depth review for the foreseeable future. So I'm approving this based on the last serious review I did (some months ago, alas). It would be great to get a more recent review, though.

@pablogsal
Copy link
Member
pablogsal commented Feb 27, 2021

If @tim-one approves we might get this into alpha 6 which goes out Monday. @pablogsal what do you think?

Yup, it should not be any problem. As I have a SC meeting on Monday I will probably start the release a bit later than usual (around 7PM London time).

I could also hold it a bit more if needed :)

@tim-one
Copy link
Member
tim-one commented Feb 28, 2021

To be explicit here, am I "it" for hitting the "Squash and merge" button if/when the time comes for that? Fine by me if so, just want to be clear so it doesn't get dropped due to mistaken assumptions.

If I am "it", and don't hear more, I'll hit the button tomorrow afternoon (about 18 hours from now, approximately 19:00 CST Saturday, so about 13:00 CST Sunday).

@tim-one tim-one merged commit 73a85c4 into python:master Feb 28, 2021
@gvanrossum
Copy link
Member

W00t! This deserves a note in what's new as well (Doc/whatsnew/3.10.rst).

sweeneyde added a commit to sweeneyde/cpython that referenced this pull request Feb 28, 2021
tim-one pushed a commit that referenced this pull request Feb 28, 2021
@sweeneyde sweeneyde deleted the two-way-2 branch December 19, 2021 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0