I suggest adding flag - `full: bool`

by default it is False. And if it is True, then it runs: 
https://github.com/numpy/numpy/blob/main/doc/neps/nep-0001-npy-format.rst

The whole point is that it should be implemented in C.

Currently:
```
def save(a):
     m = io.BytesIO()
     np.save(m, a)   # / np.lib.format.write_array
     return m

a = np.ones((1000, 100))

 %timeit save(a)
90.8 µs
%timeit a.tobytes()
37 µs
```

So... For extra few bytes performance decreases almost 3 times. Mostly due to 
copy operations. There are stack questions regarding this. Also, various 
libraries implementing custom types in messagepack and json serialisers, etc...

Such improvement would benefit performance and improve simplicity in various 
places.

Regards,
DG
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: [email protected]

Reply via email to