Message168528
| Author |
bsdphk |
| Recipients |
bsdphk |
| Date |
2012年08月18日.20:19:35 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1345321177.26.0.0602208919047.issue15723@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
When a file is opened in append mode, the operating system guarantees that all write(2) system calls atomically appended their payload to the file.
At least on FreeBSD, Python breaks this guarantee, by chopping up large writes into multiple write(2) syscalls to the OS.
Try running this program using ktrace/truss/strace or a similar system-call tracing facility:
fo = open("/tmp/_bogus", "ab", 0)
fo.write(bytearray(1024*1024))
fo.close()
Instead of one single megabyte write, I see 1024 kilobyte writes.
(BTW: Why only one kilobyte ? That is an incredible pessimisation these days...)
I leave it to the python community to decide if this should be fixed, or merely pointed out in documentation (os.write() is a workaround) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年08月18日 20:19:37 | bsdphk | set | recipients:
+ bsdphk |
| 2012年08月18日 20:19:37 | bsdphk | set | messageid: <1345321177.26.0.0602208919047.issue15723@psf.upfronthosting.co.za> |
| 2012年08月18日 20:19:36 | bsdphk | link | issue15723 messages |
| 2012年08月18日 20:19:35 | bsdphk | create |
|