bytebuf-1-inplace.py 255 B

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