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 <[email protected]>
<http://bugs.python.org/issue30404>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com