Skip to content

Allow finer control of caches in image loaders #137

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

NicoKiaru
Copy link
Contributor

Adds a CacheOverrider interface and implementations of this interface in:

  • Hdf5ImageLoader
  • N5ImageLoader
  • ImarisImageLoader
  • RemoteImageLoader

Adds a constructor in VolatileGlobalCellCache with a LoaderCache argument.

Together these modifications allow to get a finer control over the caching mechanism used when loading a dataset. In practice, using a BoundedSoftRefLoaderCache with a fixed number a cells instead of a SoftRefLoaderCache can lead to very significant performance improvement. Cached cells can be released: 1 - before the RAM gets full, 2 - more efficiently (and aggressively) than when SoftRefs are released by the garbage collector.

This PR maintains backward compatibility and does not modify the default behaviour (SoftRefLoaderCache).

NicoKiaru added 2 commits May 14, 2022 16:40
* Hdf5ImageLoader
* N5ImageLoader
* ImarisImageLoader
* RemoteImageLoader
Allows finer control over the amount of RAM that will be used before discarding loaded cells.
…gument. Allows to use different cache implementations (BoundedSoftRefLoaderCache for instance).
@NicoKiaru NicoKiaru marked this pull request as draft May 14, 2022 15:05
@NicoKiaru
Copy link
Contributor Author

Converted to draft because I needed to double check that changing the cache a posteriori does not bring unexpected issues (I can confirm the performance improvement, but not exactly the way it's done in the PR)

@NicoKiaru NicoKiaru marked this pull request as ready for review May 15, 2022 14:32
@NicoKiaru
Copy link
Contributor Author

Works fine, so I'm removing the draft status

@NicoKiaru
Copy link
Contributor Author

Hi @tpietzsch,

Do you think you could your opinion on this PR ? Do you think it's in good shape or is there something with the modifications which does not look nice to you ?

NicoKiaru added a commit to BIOP/bigdataviewer-image-loaders that referenced this pull request Apr 5, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant