Add caching layer for TIFF strips#52
Conversation
ce9577b to
def5d62
Compare
|
Thanks for the ideas here @pritgit28. I think something like this or what @mdales proposed in #31 would be good. I think to make our lives easier it would be good for us to internally hide the implementation details of the cache from ourselves and expose some interface to the cache, that way if we refactor the cache it will be much easier (I'm thinking about when it comes to adding write support). Concretely I think we need a type t
(** A cache for raw tiff data *)
type key = int
val add : t -> key -> Cstruct.t -> unit
val find : t -> key -> Cstruct.t option
val reset : t -> unitWe could then implement that under-the-hood as a hashtable, or an association list, or something more optimised/featureful later. What do you think? |
|
@patricoferris I’m always blown away after your walkthrough. My idea was based entirely on #31 . I will keep the implementation modular as guided. I just have doubts about what must be cached, should we cache after decompression or the compressed data. I couldn’t pick up which one from the comment under type t which says “a cache for raw tiff data”. |
@patricoferris Hi! This pr includes comments about ideas and design for a caching layer using a hash map for O(1) lookups. If I were to implement the cache layer, this is the layout I was able to come up with. Kindly look through the comments and guide me on what needs changes or additions, and I will incorporate that into my final implementation.