Closed bobveringa closed 2 years ago
@peterhinch
I forgot to add a small side note with this PR. If you are using C module and use the mp_obj_new_bytearray_by_ref
any changes you make to the bytearray will be transmitted as the byte array is no longer copied.
I suspect that the number of users that this impacts is incredibly small. And the solution is just to make a copy yourself before transmitting.
Optimize the memory usage of
.as_read()
and.as_write()
functions. This is done primarily be using memory view to avoid making copies during slicing of the byte array. But also by changing the way memory is allocated when reading from the socket to prevent memory reallocation. This reallocation could lead to fragmentation of memory, preventing optimal use of it.Related to issue #75