summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-05-05 04:34:18 (GMT)
committerGuido van Rossum <guido@python.org>2006-05-05 04:34:18 (GMT)
commita0867f79bbdd2b38add23fced8e5ae071ce09f70 (patch)
treec75bd662d3e363c90e07f291699bd1385b7ea06c /Include
parent5584245f584edc88d02bdebf7864e31f086622c6 (diff)
downloadcpython-a0867f79bbdd2b38add23fced8e5ae071ce09f70.zip
cpython-a0867f79bbdd2b38add23fced8e5ae071ce09f70.tar.gz
cpython-a0867f79bbdd2b38add23fced8e5ae071ce09f70.tar.bz2
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.
Diffstat (limited to 'Include')
-rw-r--r--Include/bytesobject.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/bytesobject.h b/Include/bytesobject.h
index 72ca076..849078d 100644
--- a/Include/bytesobject.h
+++ b/Include/bytesobject.h
@@ -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;