Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
87d0b454
Commit
87d0b454
authored
Feb 03, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #15381: Optimized io.BytesIO to make less allocations and copyings.
parent
83e80279
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
159 additions
and
189 deletions
+159
-189
Doc/whatsnew/3.5.rst
Doc/whatsnew/3.5.rst
+3
-0
Lib/test/test_memoryio.py
Lib/test/test_memoryio.py
+2
-3
Misc/NEWS
Misc/NEWS
+2
-0
Modules/_io/bytesio.c
Modules/_io/bytesio.c
+152
-186
No files found.
Doc/whatsnew/3.5.rst
View file @
87d0b454
...
...
@@ -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
=======================
...
...
Lib/test/test_memoryio.py
View file @
87d0b454
...
...
@@ -718,12 +718,11 @@ class CBytesIOTest(PyBytesIOTest):
@
support
.
cpython_only
def
test_sizeof
(
self
):
basesize
=
support
.
calcobjsize
(
'P2n
N2PnP
'
)
basesize
=
support
.
calcobjsize
(
'P2n
2Pn
'
)
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.
...
...
Misc/NEWS
View file @
87d0b454
...
...
@@ -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.
...
...
Modules/_io/bytesio.c
View file @
87d0b454
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment