Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListSet ¶
type ListSet struct {
// contains filtered or unexported fields
}
ListSet is a reusable list with very efficient resets. Inspired by the C++ implementation in hnswlib it can be reset with zero memory writes in the array by moving the match target instead of altering the list. Only after a version overflow do we need to actually reset
The new implementation uses a slice where the first element is reserved for the marker. This allow us to use ListSet as a value (i.e. no pointer is required) The marker (i.e. set[0]) allows for reusing the same list without having to zero all elements on each list reset. Resetting the list takes place once the marker (i.e. set[0]) overflows
type Pool ¶
func NewPool ¶
NewPool creates a new pool with specified size. listSetSize specifies the size of a list at creation time point maxStorage specifies the maximum number of lists that can be stored in the pool, the pool can still generate infinite lists, but if more than maxStorage are returned to the pool, some lists will be thrown away.