Skip to content

Optimize fs::copy #824

Closed
Closed
@phip1611

Description

@phip1611

Currently, FileSystem::copy

/// Copies the contents of one file to another. Creates the destination file
/// if it doesn't exist and overwrites any content, if it exists.
pub fn copy(
&mut self,
src_path: impl AsRef<Path>,
dest_path: impl AsRef<Path>,
) -> FileSystemResult<()> {
let read = self.read(src_path)?;
self.write(dest_path, read)
}

is inefficient. It should be refactored to use a 2 MiB buffer or so to avoid allocations of possibly multiple gigabytes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions