You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2010/04/11 21:27:33 UTC

DO NOT REPLY [Bug 49085] New: [PATCH] Speed up file I/O

https://issues.apache.org/bugzilla/show_bug.cgi?id=49085

           Summary: [PATCH] Speed up file I/O
           Product: APR
           Version: 1.3.9
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: stefanfuhrmann@alice-dsl.de


Created an attachment (id=25251)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25251)
File I/O speedup patch

The current file I/O comes with large call overhead,
in particular under Windows. For some common usage
that translates into a large relative overhead.

These usages are: reading individual bytes (parser)
or writing small chunks of data (generator outputs).
If we are using non-buffered or multi-threaded files,
some larger sync / OS overhead is required in any 
case. So, we only optimize for the buffered, single-
threaded case.

Another optimization is not buffering large chunks
of data on the write path. That saves extra copies 
and does not pollute the data buffer.

[[[
Minimize relative overhead for buffered I/O of 
small data blocks. Also, eliminate mutex overhead
from single-threaded Win32 code.

* file_io/unix/readwrite.c
  (apr_file_write): add "shortcut" for small buffers;
  don't buffer large chunks at all
  (apr_file_putc, apr_file_getc): add shortcut 
  for the common case

* file_io/win32/readwrite.c
  (apr_file_read): use mutex only if the file is
  possibly accessed from multiple threads
  (apr_file_write_locked): new function, factored
  out from apr_file_flush
  (apr_file_write): defer OVERLAPPED handling;
  use mutex only if the file is possibly accessed 
  from multiple threads; add "shortcut" for small 
  buffers; don't buffer large chunks at all
  (apr_file_putc, apr_file_getc): add shortcut 
  for the common case
  (apr_file_flush): moved most code to 
  apr_file_write_locked

patch by stefanfuhrmann < at > alice-dsl.de
]]]

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 49085] [PATCH] Speed up file I/O

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49085

--- Comment #1 from Stefan Fuhrmann <st...@alice-dsl.de> 2010-04-20 19:17:15 EDT ---
Created an attachment (id=25326)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25326)
File I/O speedup patch - v2

update patch

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 49085] [PATCH] Speed up file I/O

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49085

--- Comment #2 from Stefan Fuhrmann <st...@alice-dsl.de> 2010-04-20 19:20:55 EDT ---
Updated patch comment:

[[[
Minimize relative overhead for buffered I/O of 
small data blocks. Also, eliminate mutex overhead
from single-threaded Win32 code.

* file_io/unix/readwrite.c
  (file_read_buffered): don't buffer large chunks at all
  (apr_file_write): add "shortcut" for small buffers;
  don't buffer large chunks at all
  (apr_file_putc, apr_file_getc): add shortcut 
  for the common case

* file_io/win32/readwrite.c
  (apr_file_read): use mutex only if the file is
  possibly accessed from multiple threads;
  don't buffer large chunks at all
  (apr_file_write_locked): new function, factored
  out from apr_file_flush
  (apr_file_write): defer OVERLAPPED handling;
  use mutex only if the file is possibly accessed 
  from multiple threads; add "shortcut" for small 
  buffers; don't buffer large chunks at all
  (apr_file_putc, apr_file_getc): add shortcut 
  for the common case
  (apr_file_flush): moved most code to 
  apr_file_write_locked

patch by stefanfuhrmann < at > alice-dsl.de
]]]

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org