[issue30404] Make stdout and stderr truly unbuffered when using -u option
Serhiy Storchaka
report at bugs.python.org
Mon Jun 19 10:21:07 EDT 2017
Serhiy Storchaka added the comment:
Writing separate lines:
$ ./python -m timeit -s 'import sys' -s 'with open("setup.py") as f: s = f.readlines()' 'sys.stderr.writelines(s)' 2>/dev/null
200 loops, best of 5: 1.07 msec per loop
$ ./python -u -m timeit -s 'import sys' -s 'with open("setup.py") as f: s = f.readlines()' 'sys.stderr.writelines(s)' 2>/dev/null
Unpatched: 50 loops, best of 5: 5.89 msec per loop
Patched: 100 loops, best of 5: 3.32 msec per loop
Writing separate characters:
$ ./python -m timeit -s 'import sys' -s 'with open("setup.py") as f: s = list(f.read())' 'sys.stderr.writelines(s)' 2>/dev/null
10 loops, best of 5: 30 msec per loop
$ ./python -u -m timeit -s 'import sys' -s 'with open("setup.py") as f: s = list(f.read())' 'sys.stderr.writelines(s)' 2>/dev/null
Unpatched: 5 loops, best of 5: 49.2 msec per loop
Patched: 2 loops, best of 5: 137 msec per loop
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30404>
_______________________________________
More information about the Python-bugs-list
mailing list