Micro-optimization: Use storage.Store.ImagesByDigest for digest references
Runtime.lookupImageInDigestsAndRepoTags calls, in https://github.com/containers/common/blob/18c4568e8ee051fd8ded1d9d47cfa0453b1d6a0c/libimage/runtime.go#L426, effectively storage.Store.Images, getting a copy of all images.
On the https://github.com/containers/common/blob/18c4568e8ee051fd8ded1d9d47cfa0453b1d6a0c/libimage/runtime.go#L441 path, allImages is manually filtered to only those (the first one) that actually match that digest in storage.Image.Digests.
It seems to me that that code path could call storage.Store.ImagesByDigest, and the full allImages collection could only happen later, to implement the inRepoTags search.
That would save a bit of memory and CPU time when copying image objects from the c/storage primary records into a return value, and the like — OTOH it’s all on a “fallback heuristics” path, so it might well not be worth worrying about.