Skip to content

Accessing data in chunks at runtime rather than loading everything on instantiation #23

Open
@kylecarow

Description

@kylecarow

Hey there!

I noticed this crate runs Decoder::read_image on instantiating a GeoTiff, meaning any time you're working with an image, the entire image must be loaded into memory. To me, this seemed like a possible performance issue for large files, especially when working with small sections of the image.

In my project, when I access data at a specific point, I instead compute the chunk index that contains the pixel(s) of interest, then use Decoder::read_chunk to access the chunk data. The result is a much smaller DecodingResult being held in memory.

I also have a method for accessing at multiple points. It internally organizes the requested points by chunk, then iterates to read all points within each chunk, and reorganizes outputs in the original order (e.g. corresponding to the inputs). Thus, only a single chunk is in memory at a given time, and each chunk is read at most once.

I think these ideas might have some value, perhaps they could be implemented or adopted to some degree in this crate?

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