On Fri, 14 Jun 2013 04:24:53 -0400, Denis Koroskin <2kor...@gmail.com> wrote:

On Friday, 14 June 2013 at 08:17:02 UTC, Walter Bright wrote:
On 6/14/2013 1:11 AM, Denis Koroskin wrote:
Does it look like it's slower? To me it looks like it's actually FASTER with a
flush, although I don't know why.

Because of write caching, you can get very different results from one run to the next of the same program.

I re-ran them a few times obviously. The results were consistent.

Walter is right to a point -- caching can effect this behavior.

There are several levels of caching at play here, and all of them are working hard to optimize the writing to disk. That likely is more of a cause than the flushing of the first element.

But in that sense, his argument is also broken -- you have to be in a very special situation (no caching, no drivers, etc.) in order for this to matter.

I had a similar test, and my results were not consistently one better than the other, but basically flushing had no discernible effect.

And quite honestly, if disk performance were dependent on user-land C buffering schemes, C runtime writers would pay more attention to the C buffering scheme and make sure it performs well! i.e. if a single misaligned write can mess up gigabytes of output, then the next write would correct it.

-Steve

Reply via email to