wagoodman / dive

A tool for exploring each layer in a docker image
MIT License
44.81k stars 1.7k forks source link

Speed up initial loading #125

Open ChrisCinelli opened 5 years ago

ChrisCinelli commented 5 years ago

To speed up the initial loading time you can use caching on disk (point 5 on #119) that makes a breeze loading images already pre-processed.

For new images, you may also show something to the user and layers are being processed and keep building the rest of the tree in background. You probably need to add a RWMutex on the tree for this.

wagoodman commented 5 years ago

I pondered disk caching but ultimately decided that it would take up a lot of disk space. If it were an opt-in configurable it would make more sense... this way a user won't be surprised by dive taking up a bunch of disk space. A section to the dive.yaml could be added:

cache:
  enabled: true
  # keep up to X MB of cache before purging the oldest 
  size: 300MB
  location: ~/.dive/cache

I've considered adding the image processing as a background task instead of a pre-UI task. In the future I'll probably add it, but wasn't planning on adding it soon.

ChrisCinelli commented 5 years ago

You only cache files name and metadata, not content. It will take some space but not a ton. You can have an option as you describe to turn it off but I think should be opt out. I would add an option on CLI to clear the cache or clear just a specific image or maybe by last access (default everything older than 6 months) etc.