mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Optimizations for bytes reallocation.
This uses up to 12.5% overallocation, not entirely unlike list_resize(). Could probably use more tweaks for odd allocation patterns, TBD. Also add __alloc__() method which returns the actually allocated size. PS. I'm now convinced that we need something like "".join(); later.
This commit is contained in:
parent
5584245f58
commit
a0867f79bb
2 changed files with 54 additions and 11 deletions
|
@ -21,6 +21,7 @@ extern "C" {
|
|||
/* Object layout */
|
||||
typedef struct {
|
||||
PyObject_VAR_HEAD
|
||||
Py_ssize_t ob_alloc; /* How many bytes allocated */
|
||||
char *ob_bytes;
|
||||
} PyBytesObject;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue