Sam writes:
> int main(int argc, char **argv)
> {
> char buf[8192];
...
> }
>
> [mrsam@ny mrsam]$ time ./a.out >/dev/null
> Command exited with non-zero status 255
If you'll notice, this one bombed, so its timing results are useless.
You probably hit stack overflow with that 8192-byte array. Of course,
you fixed that in the next one, which ran successfully:
> char buf[8192];
>
> int main(int argc, char **argv)
But you didn't go back to fix it in the first one. If you're trying
to demonstrate the timing effect of one big write versus many small
writes, then let that be the only difference between the two programs.
Write the same data in both programs. (What you actually did was to
write the same byte many times instead of each byte once.) No
redundant zeroing, no redundant iterators - unless they're common to
both programs.
paul