Bug 33485 - apr_file_flush on unbuffered files vastly more expensive on Windows
Summary: apr_file_flush on unbuffered files vastly more expensive on Windows
Status: RESOLVED FIXED
Alias: None
Product: APR
Classification: Unclassified
Component: APR (show other bugs)
Version: HEAD
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-10 09:20 UTC by Curt Arnold
Modified: 2006-02-15 10:46 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Curt Arnold 2005-02-10 09:20:41 UTC
Calling apr_file_flush on an unbuffered file is a no-op in the Unix and OS/2
implementations, however on Windows it is a call to FileFlushBuffers which can
be an incredibly expensive call.  I ran into this when the Windows build of
log4cxx was 100-fold slower when writing to file than the Linux build.

I've worked around the problem in log4cxx, however this seems like a landmine to
catch unsuspecting developers.  

As it currently stands, apr_file_flush on Win32 leaves the buffered and
unbuffered files in different states.  If buffered, it flushes the APR
maintained buffer but doesn't flush the OS buffer by calling FileFlushBuffers.
Comment 1 William A. Rowe Jr. 2006-02-15 19:46:11 UTC
  Committed, and backported for the next 0.9 and 1.2 releases.