1# Doing some operation on bytearray 2# Inplace - the most memory efficient way 3import bench 4 5 6def test(num): 7 for i in iter(range(num // 10000)): 8 ba = bytearray(b"\0" * 1000) 9 for i in range(len(ba)): 10 ba[i] += 1 11 12 13bench.run(test) 14