import os ys = 'y\n' * 2048 while True: os.write(1, ys)
(had to separate the asters to stop HN swallowing them)
Plain old `yes` gets a measly 33Mb/s!!
import sys s = b'y\n' * 1024 write = sys.stdout.buffer.write while True: write(s) # 1.12GiB/s
The Python3 docs say to "use the underlying binary buffer object" when reading or writing binary data.
https://docs.python.org/3/library/sys.html
(had to separate the asters to stop HN swallowing them)
Plain old `yes` gets a measly 33Mb/s!!