-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
bpo-24821: Fixed the slowing down to 25 times in the searching of some #505
Conversation
unlucky Unicode characters.
@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. |
Objects/stringlib/fastsearch.h
Outdated
if (needle != 0) { | ||
while (p < e) { | ||
if (needle != 0) | ||
while (e - p > MEMCHR_CUT_OFF) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Objects/stringlib/fastsearch.h
Outdated
#if STRINGLIB_SIZEOF_CHAR == 1 | ||
p = memrchr(s, ch, n); | ||
p = memrchr(s, ch, n * sizeof(STRINGLIB_CHAR)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…ves' into bpo-24821-find-char-false-positives
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>
unlucky Unicode characters.