FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-117431: Improve performance of startswith and endswith by eendebakpt · Pull Request #117782 · python/cpython · GitHub

Repository navigation

Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .c  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
code style
  • Loading branch information
eendebakpt committed Apr 11, 2024
commit 4f4b084eadd50e65f165ad011777e5a7991ff240
9 changes: 5 additions & 4 deletions Objects/unicodeobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -9272,12 +9272,13 @@ tailmatch(PyObject *self,
else
offset = start;

int last_character_matches = PyUnicode_READ(kind_self, data_self, offset + end_sub) ==
PyUnicode_READ(kind_sub, data_sub, end_sub);
int match_last = PyUnicode_READ(kind_self, data_self, offset + end_sub) ==
PyUnicode_READ(kind_sub, data_sub, end_sub);

if (last_character_matches) {
if (end_sub==0)
if (match_last) {
if (end_sub==0) {
Comment thread
eendebakpt marked this conversation as resolved.
Resolved
return 1;
}
/* If both are of the same kind, memcmp is sufficient */
if (kind_self == kind_sub) {
return ! memcmp((char *)data_self + (offset * kind_sub),
Expand Down

Back | FazBrowse Home | New Git URL