You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hits map is kind of unnecessary. It can be replaced by a slice [][]byte where the index maps to the input keys. This should save some memory when fetching data from caches.
Describe the solution you'd like
Change FetchMultiPostings to this method below. We can even change misses to []int and see if it is something easy to do.
To convert 'Label' to an int probably requires some forms of hash function, but it will always compromise to the possibility (despite very low) of collision which would result a missing cache hit.
Would this be acceptable? or there is a better implementation you have in mind?
@Zyyeric The return result slice can use the index as of keys []labels.Label by maintaining the same order. But the downside is that we have to allocate the slice even though nothing is cached.
@yeya24 Ahh I see, this sounds valid. Despite the allocating for miss hits for the slice, its memory overhead shall still be lower than that of a map. This shall not be hard to do. I'll give it a shot.
Is your proposal related to a problem?
IndexCache
interface has two FetchMulti methodsFetchMultiPostings
andFetchMultiSeries
.For example,
FetchMultiPostings
looks like below:The
hits
map is kind of unnecessary. It can be replaced by a slice[][]byte
where the index maps to the inputkeys
. This should save some memory when fetching data from caches.Describe the solution you'd like
Change
FetchMultiPostings
to this method below. We can even changemisses
to[]int
and see if it is something easy to do.The text was updated successfully, but these errors were encountered: