pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/593bb30e82eded7f2ec02f7d1aa49742e6962113

9af82350aeda.css" /> closes bpo-34599: Improve performance of _Py_bytes_capitalize(). (GH-… · python/cpython@593bb30 · GitHub
Skip to content

Commit 593bb30

Browse files
sir-sigurdbenjaminp
authored andcommitted
closes bpo-34599: Improve performance of _Py_bytes_capitalize(). (GH-9083)
1 parent b03c2c5 commit 593bb30

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

Objects/bytes_methods.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -361,23 +361,9 @@ and the rest lower-cased.");
361361
void
362362
_Py_bytes_capitalize(char *result, const char *s, Py_ssize_t len)
363363
{
364-
Py_ssize_t i;
365-
366-
if (0 < len) {
367-
int c = Py_CHARMASK(*s++);
368-
if (Py_ISLOWER(c))
369-
*result = Py_TOUPPER(c);
370-
else
371-
*result = c;
372-
result++;
373-
}
374-
for (i = 1; i < len; i++) {
375-
int c = Py_CHARMASK(*s++);
376-
if (Py_ISUPPER(c))
377-
*result = Py_TOLOWER(c);
378-
else
379-
*result = c;
380-
result++;
364+
if (len > 0) {
365+
*result = Py_TOUPPER(*s);
366+
_Py_bytes_lower(result + 1, s + 1, len - 1);
381367
}
382368
}
383369

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy