mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Speedup str[a:b] and PyUnicode_FromKindAndData
* str[a:b] doesn't scan the string for the maximum character if the string is ascii only * PyUnicode_FromKindAndData() stops if we are sure that we cannot use a shorter character type. For example, _PyUnicode_FromUCS1() stops if we have at least one character in range U+0080-U+00FF
This commit is contained in:
parent
702c734395
commit
b9275c104e
2 changed files with 51 additions and 27 deletions
|
@ -654,6 +654,8 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromString(
|
|||
const char *u /* UTF-8 encoded string */
|
||||
);
|
||||
|
||||
/* Create a new string from a buffer of Py_UCS1, Py_UCS2 or Py_UCS4 characters.
|
||||
Scan the string to find the maximum character. */
|
||||
#ifndef Py_LIMITED_API
|
||||
PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData(
|
||||
int kind,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue