Message149560
| Author |
pitrou |
| Recipients |
benjamin.peterson, gjb1002, gvanrossum, pitrou, pjenvey, stutzbach |
| Date |
2011年12月15日.14:27:01 |
| SpamBayes Score |
9.699352e-12 |
| Marked as misclassified |
No |
| Message-id |
<1323959199.3345.7.camel@localhost.localdomain> |
| In-reply-to |
<1323876594.8.0.471569022136.issue13601@psf.upfronthosting.co.za> |
| Content |
> Line-buffering should be good enough since in practice errors messages
> are always terminated by a newline.
What I think too.
> I'm hesitant to make it line-buffered by default when directed to a
> file, since this could significantly slow down a program that for some
> reason produces super-voluminous output (e.g. when running a program
> with heavy debug logging turned on).
The slow-down is impressive in relative terms (6x) but the timings are
still small in absolute value:
$ ./python -m timeit -s "f=open('/dev/null', 'a', buffering=4096)" "f.write('log message\n')"
10000000 loops, best of 3: 0.156 usec per loop
$ ./python -m timeit -s "f=open('/dev/null', 'a', buffering=1)" "f.write('log message\n')"
1000000 loops, best of 3: 0.961 usec per loop |
|