Skip to content

bpo-24821: Fixed the slowing down to 25 times in the searching of some #505

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

Conversation

serhiy-storchaka
Copy link
Member

unlucky Unicode characters.

@serhiy-storchaka serhiy-storchaka added the performance Performance or resource usage label Mar 6, 2017
@mention-bot
Copy link

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Haypo, @Yhg1s, @ned-deily, @florentx and @Carreau to be potential reviewers.

if (needle != 0) {
while (p < e) {
if (needle != 0)
while (e - p > MEMCHR_CUT_OFF) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe do ... while ... is better here? The first time e - p > MEMCHR_CUT_OFF is always true.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

#if STRINGLIB_SIZEOF_CHAR == 1
p = memrchr(s, ch, n);
p = memrchr(s, ch, n * sizeof(STRINGLIB_CHAR));
Copy link
Member

Choose a reason for hiding this comment

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

Why this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, no good reason. Perhaps I tried to unify this with the code for STRINGLIB_SIZEOF_CHAR != 1.

}
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

How about assert(e - p <= MEMCHR_CUT_OFF) here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is obvious if use a do-while loop.

Copy link
Member

Choose a reason for hiding this comment

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

Ohh, yes. I comment with the previous code.

@serhiy-storchaka serhiy-storchaka merged commit 0a58f72 into python:master Mar 30, 2017
@serhiy-storchaka serhiy-storchaka deleted the bpo-24821-find-char-false-positives branch March 30, 2017 06:11
jaraco pushed a commit that referenced this pull request Dec 2, 2022
Bumps [redis](https://github.com/redis/redis-py) from 3.5.3 to 4.1.0.
- [Release notes](https://github.com/redis/redis-py/releases)
- [Changelog](https://github.com/redis/redis-py/blob/master/CHANGES)
- [Commits](redis/redis-py@3.5.3...v4.1.0)

---
updated-dependencies:
- dependency-name: redis
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants