Skip to content

possible optimizations for large files? #11

Description

@btraven00

very nice to see this!

Couple of quick thoughts for dealing with large buffers and perhaps saving on the memory footprint (I'm not too familiar with R internals tho).

  1. Maybe consider shaving off the double memory allocation? (first, second). Since the read is sequential, would it be feasible to move the payload reading to the C side, allocate the vector and then fread the chunks directly into the destination buffer? (header parse can stay in R and pass the path + offset, or move to C too?).

  2. Longer term, it would be ~natural to think about having the equivalent of the mmap_mode=r of numpy, for lazy/partial reads. Sounds like this can be done using the ALTREP API?

If any of this is useful for this package and its community I could look into drafting a PoC, it's a problem that was in my roadmap for convergent reasons. Thanks for reading!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions