On 6/11/2013 10:15 PM, deadalnix wrote:
On Wednesday, 12 June 2013 at 04:23:39 UTC, Walter Bright wrote:
I don't agree. Buffering is often done on page size boundaries - throwing out
a random number of characters and then flushing will get it all wonky.

You clearly missed something in the discussion here. The proposal is to flush
once at first use, so an Exception is thrown. Nothing change after that first
flush at initialization, other flushes stay where they are.

Not at all. A flush forces a write to the disk - that's the point of it. Disks are not at all well tuned to writing a few bytes, they like to be written in aligned blocks of block sizes, and the I/O subsystem is designed for that.

This is why stdout has a flag in it saying if it is a "block oriented" or "character oriented" device. It makes a big difference. This proposal attempts to treat a block device like a character device. It will work, but it will perform poorly.

P.S. I've written device drivers for disks.

P.P.S. The solution is simple, as I said earlier. Just do a flush after main() exits. It happens anyway - done by the C stdio subsystem - I just propose doing it in the D code before it hands things back to the C runtime. This will entail no performance degradation.

Reply via email to