[erlang-patches] Added native OS file system copy to efile

Björn Gustavsson bgustavsson@REDACTED
Wed Oct 6 15:45:03 CEST 2010


On Tue, Oct 5, 2010 at 9:33 PM, Blaine Whittle <BWhittle@REDACTED> wrote:
> prim_file:copy has a comment that reads " xxx Should be moved down to the driver for optimization".  This patch does just that, however to ensure compatibility I haven't changed the existing implementation of prim_file:copy/3;  I've added two new functions prim_file:raw_copy/2, and prim_file:raw_copy/3 which perform the copy in the driver.
>
> git fetch git://github.com/bwhittle/otp.git prim_file_copy
>

As currently written, copying a huge file will block
the thread for entire duration of the copy operation.
That is not OK.

If the copy function is to be moved to the driver,
there must be a limit to the number of bytes that
the driver is allowed to copy at one time. When
that number has been exceeded, the driver should
return control to the Erlang process to allow other
Erlang processes to be run. That was the original
idea behind the comment, but it is not really
clear that it would improve performance much.

Do you have a real need for a faster file copy
operation or is it just nice to have?

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB


More information about the erlang-patches mailing list