Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SourceAccessor::readFile should be streaming in constant memory #11001

Open
roberth opened this issue Jul 1, 2024 · 1 comment
Open

SourceAccessor::readFile should be streaming in constant memory #11001

roberth opened this issue Jul 1, 2024 · 1 comment
Labels
fetching Networking with the outside (non-Nix) world, input locking performance

Comments

@roberth
Copy link
Member

roberth commented Jul 1, 2024

Describe the bug

This reads a whole file into memory.

void SourceAccessor::readFile(
    const CanonPath & path,
    Sink & sink,
    std::function<void(uint64_t)> sizeCallback)
{
    std::string s = readFile(path);
    sizeCallback(s.size());
    sink(s);
}

Steps To Reproduce

Expected behavior

Multiple sink(chunk) calls.

nix-env --version output

Additional context

Priorities

Add 👍 to issues you find important.

@roberth roberth added bug performance fetching Networking with the outside (non-Nix) world, input locking labels Jul 1, 2024
@edolstra edolstra removed the bug label Jul 1, 2024
@L-as
Copy link
Member

L-as commented Jul 17, 2024

Ideally it would be zero-copy too. Is there a cross-platform way of doing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fetching Networking with the outside (non-Nix) world, input locking performance
Projects
None yet
Development

No branches or pull requests

3 participants