import time for n in (100000, 200000, 300000, 400000): data = b'x'*n b = data start = time.time() while b: b = b[1:] end = time.time() print(end-start)
for n in (100000, 200000, 300000, 400000): data = b'x'*n start = time.time() b = memoryview(data) while b: b = b[1:] end = time.time() print(end-start)