What exactly is the point of memoryview in Python
One reason memoryviews are useful is that they can be sliced without copying the underlying data, unlike bytes/str. For example, take the following toy example. import time for n in (100000, 200000, 300000, 400000): data = b’x’*n start = time.time() b = data while b: b = b[1:] print(f’ bytes {n} {time.time() – start:0.3f}’) for … Read more