Commit 87d0b454 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #15381: Optimized io.BytesIO to make less allocations and copyings.

parent 83e80279
......@@ -362,6 +362,9 @@ The following performance enhancements have been added:
The speed up can range from 3x to 15x.
(:issue:`21486`, :issue:`21487`, :issue:`20826`)
* Many operations on :class:`io.BytesIO` are now 50% to 100% faster.
(Contributed by Serhiy Storchaka in :issue:`15381`.)
Build and C API Changes
=======================
......
......@@ -718,12 +718,11 @@ class CBytesIOTest(PyBytesIOTest):
@support.cpython_only
def test_sizeof(self):
basesize = support.calcobjsize('P2nN2PnP')
basesize = support.calcobjsize('P2n2Pn')
check = self.check_sizeof
self.assertEqual(object.__sizeof__(io.BytesIO()), basesize)
check(io.BytesIO(), basesize )
check(io.BytesIO(b'a'), basesize + 1 )
check(io.BytesIO(b'a' * 1000), basesize + 1000)
check(io.BytesIO(b'a' * 1000), basesize + sys.getsizeof(b'a' * 1000))
# Various tests of copy-on-write behaviour for BytesIO.
......
......@@ -232,6 +232,8 @@ Core and Builtins
Library
-------
- Issue #15381: Optimized io.BytesIO to make less allocations and copyings.
- Issue #22818: Splitting on a pattern that could match an empty string now
raises a warning. Patterns that can only match empty strings are now
rejected.
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment