[New-bugs-announce] [issue47199] multiprocessing: micro-optimize Connection.send_bytes() method
Ma Lin
report at bugs.python.org
Sat Apr 2 02:28:23 EDT 2022
New submission from Ma Lin <malincns at 163.com>:
`bytes(m)` can be replaced by memoryview.cast('B'), then no need for data copying.
m = memoryview(buf)
# HACK for byte-indexing of non-bytewise buffers (e.g. array.array)
if m.itemsize > 1:
m = memoryview(bytes(m))
n = len(m)
https://github.com/python/cpython/blob/v3.11.0a6/Lib/multiprocessing/connection.py#L190-L194
----------
components: Library (Lib)
messages: 416538
nosy: malin
priority: normal
severity: normal
status: open
title: multiprocessing: micro-optimize Connection.send_bytes() method
type: resource usage
versions: Python 3.11
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47199>
_______________________________________
More information about the New-bugs-announce
mailing list