[ redirected to pgsql-hackers instead of -patches ]
Matthew Kirkwood <matthew@hairy.beasts.org> writes:
> On Sat, 24 Feb 2001, Bruce Momjian wrote:
>> I am confused why mmap() is better than writing to a real file.
> It isn't, except that it allows to initialise the logfile in
> one syscall, without first allocating and zeroing (and hence
> dirtying) 16Mb of memory.
Uh, the existing code does not zero 16Mb of memory... it zeroes
8K and then writes that block repeatedly. It's possible that the
overhead of a syscall for each 8K block is significant, but on the
other hand writing a block at a time is a heavily used and heavily
optimized path in all Unixen. It's at least as plausible that the
mmap-as-source-of-zeroes path will be slower!
I think this is worth looking into, but I'm very far from being
sold on it...
regards, tom lane