On 04/28/2013 11:31 AM, Janne Blomqvist wrote: > PING > > On Fri, Apr 19, 2013 at 1:30 PM, Janne Blomqvist > <blomqvist.ja...@gmail.com> wrote: >> Hi, >> >> the attached patch improves the performance for unformatted and >> unbuffered files. Currently unbuffered unformatted really means that >> we don't buffer anything and use the POSIX I/O syscalls directly. With >> the patch, we use the buffer but flush it at the end of each I/O >> statement. >> >> (For formatted I/O we essentially already do this, as the format >> buffer (fbuf) buffers each record). >> >> For the ever important benchmark of writing small (containing a single >> scalar 4 byte value) unformatted sequential records to /dev/null, the >> patch reduces the number of syscalls by a factor of 6, and performance >> improves by more than double. >> >> For trunk, time for the benchmark in the PR: >> >> real 0m0.727s >> user 0m0.272s >> sys 0m0.452s >> >> With the patch: >> >> real 0m0.313s >> user 0m0.220s >> sys 0m0.092s >> >> For comparison, writing to a file where we use buffered I/O: >> >> real 0m0.202s >> user 0m0.180s >> sys 0m0.020s >> >> >> As a semi-unrelated minor improvement, the patch also changes the >> ordering when writing out unformatted sequential record markers. >> Currently we do >> >> write bogus marker >> write record data >> write tail marker >> seek back to before the bogus marker >> write the correct head marker >> seek to the end of the record, behind the tail marker >> >> With the patch we instead do >> >> write bogus marker >> write record data >> seek back to before the bogus marker >> write the correct head marker >> seek to the end of the record data >> write tail marker >> >> With the patch, the slightly shorter seek distances ever-so-slightly >> increase the chance that the seeks will be contained within the buffer >> so we don't have to flush. >> >> Regtested on x86_64-unknown-linux-gnu, Ok for trunk? >>
OK Janne and thanks for the patch. What are your thoughts about special casing nul devices/ Jerry