3 ms·
I got 1.26Gb/s in Python2 on MacOS (i7 mac air) import os ys = 'y\n' * 2048 while True: os.write(1, ys) update: seems to peek at around 3g
by emmelaich 9y ago
I got 1.26Gb/s in Python2 on MacOS (i7 mac air)
import os
ys = 'y\n' * 2048
while True:
os.write(1, ys)
update: seems to peek at around 3gb/s with
ys = 'y\n' * 2 * * 16
(had to separate the asters to stop HN swallowing them)
Plain old `yes` gets a measly 33Mb/s!!
- jdnier 9y agoOn my Macbook with way too much running, I get about 800MiB/s in Python2 with your script, but 1.12GiB/s with this Python3 script: import sys s = b'y\n' * 1024 write = sys.stdout.buffer.write while True: write(s) # 1.12GiB/s Plain old yes comes in at 22Mib/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 https://docs.python.org/3/library/sys.html