mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-09 14:20:57 +08:00
Changed HnswPairingHeapNode to HnswSearchCandidate to reduce allocations and improve code
This commit is contained in:
@@ -155,12 +155,13 @@ struct HnswNeighborArray
|
||||
HnswCandidate items[FLEXIBLE_ARRAY_MEMBER];
|
||||
};
|
||||
|
||||
typedef struct HnswPairingHeapNode
|
||||
typedef struct HnswSearchCandidate
|
||||
{
|
||||
HnswCandidate *inner;
|
||||
pairingheap_node c_node;
|
||||
pairingheap_node w_node;
|
||||
} HnswPairingHeapNode;
|
||||
HnswElementPtr element;
|
||||
float distance;
|
||||
} HnswSearchCandidate;
|
||||
|
||||
/* HNSW index options */
|
||||
typedef struct HnswOptions
|
||||
@@ -381,7 +382,7 @@ void *HnswAlloc(HnswAllocator * allocator, Size size);
|
||||
HnswElement HnswInitElement(char *base, ItemPointer tid, int m, double ml, int maxLevel, HnswAllocator * alloc);
|
||||
HnswElement HnswInitElementFromBlock(BlockNumber blkno, OffsetNumber offno);
|
||||
void HnswFindElementNeighbors(char *base, HnswElement element, HnswElement entryPoint, Relation index, FmgrInfo *procinfo, Oid collation, int m, int efConstruction, bool existing);
|
||||
HnswCandidate *HnswEntryCandidate(char *base, HnswElement em, Datum q, Relation rel, FmgrInfo *procinfo, Oid collation, bool loadVec);
|
||||
HnswSearchCandidate *HnswEntryCandidate(char *base, HnswElement em, Datum q, Relation rel, FmgrInfo *procinfo, Oid collation, bool loadVec);
|
||||
void HnswUpdateMetaPage(Relation index, int updateEntry, HnswElement entryPoint, BlockNumber insertPage, ForkNumber forkNum, bool building);
|
||||
void HnswSetNeighborTuple(char *base, HnswNeighborTuple ntup, HnswElement e, int m);
|
||||
void HnswAddHeapTid(HnswElement element, ItemPointer heaptid);
|
||||
|
||||
Reference in New Issue
Block a user