The function apr_file_transfer_contents() called by apr_file_copy() in file_io/unix/copy.c uses the standard BUFSIZ constant as a buffer size to copy file contents. This can be very inefficient on large files when done over a network due to the numerous small packets sent. This standard constant is typically very small. (512 is the default on windows.) It is suggested to use the existing APR_FILE_BUFSIZE contant which defaults to a larger value of 4096 on Windows, or create a new constant such as APR_COPY_BUFSIZE which can be configured to an appropriately large size per platform. Using a larger buffer can increase copy times of larger files by over 2x when done on a network prototol such as NFS or SMB. The performance problem was originally seen when using Subversion. Some background discussion is available at these locations: http://subversion.tigris.org/servlets/ReadMsg?listName=dev&msgNo=82087 http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=133582 Here is the suggest patch: --- copy-old.c 2008-01-09 14:07:51.000068000 -0600 +++ copy.c 2008-01-09 14:08:25.000121000 -0600 @@ -54,7 +54,7 @@ /* Copy bytes till the cows come home. */ while (1) { - char buf[BUFSIZ]; + char buf[APR_FILE_BUFSIZE]; apr_size_t bytes_this_time = sizeof(buf); apr_status_t read_err; apr_status_t write_err;
Fixed in trunk in r651174.