mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-14 16:46:54 +08:00
Removed bench code [skip ci]
This commit is contained in:
19
src/hnsw.h
19
src/hnsw.h
@@ -12,10 +12,6 @@
|
|||||||
#include "utils/sampling.h"
|
#include "utils/sampling.h"
|
||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
|
|
||||||
#ifdef HNSW_BENCH
|
|
||||||
#include "portability/instr_time.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define HNSW_MAX_DIM 2000
|
#define HNSW_MAX_DIM 2000
|
||||||
#define HNSW_MAX_NNZ 1000
|
#define HNSW_MAX_NNZ 1000
|
||||||
|
|
||||||
@@ -75,21 +71,6 @@
|
|||||||
#define HnswPageGetOpaque(page) ((HnswPageOpaque) PageGetSpecialPointer(page))
|
#define HnswPageGetOpaque(page) ((HnswPageOpaque) PageGetSpecialPointer(page))
|
||||||
#define HnswPageGetMeta(page) ((HnswMetaPageData *) PageGetContents(page))
|
#define HnswPageGetMeta(page) ((HnswMetaPageData *) PageGetContents(page))
|
||||||
|
|
||||||
#ifdef HNSW_BENCH
|
|
||||||
#define HnswBench(name, code) \
|
|
||||||
do { \
|
|
||||||
instr_time start; \
|
|
||||||
instr_time duration; \
|
|
||||||
INSTR_TIME_SET_CURRENT(start); \
|
|
||||||
(code); \
|
|
||||||
INSTR_TIME_SET_CURRENT(duration); \
|
|
||||||
INSTR_TIME_SUBTRACT(duration, start); \
|
|
||||||
elog(INFO, "%s: %.3f ms", name, INSTR_TIME_GET_MILLISEC(duration)); \
|
|
||||||
} while (0)
|
|
||||||
#else
|
|
||||||
#define HnswBench(name, code) (code)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PG_VERSION_NUM >= 150000
|
#if PG_VERSION_NUM >= 150000
|
||||||
#define RandomDouble() pg_prng_double(&pg_global_prng_state)
|
#define RandomDouble() pg_prng_double(&pg_global_prng_state)
|
||||||
#define SeedRandom(seed) pg_prng_seed(&pg_global_prng_state, seed)
|
#define SeedRandom(seed) pg_prng_seed(&pg_global_prng_state, seed)
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
|
|||||||
*/
|
*/
|
||||||
LockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
|
LockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
|
||||||
|
|
||||||
HnswBench("scan iteration", so->w = GetScanItems(scan, value));
|
so->w = GetScanItems(scan, value);
|
||||||
|
|
||||||
/* Release shared lock */
|
/* Release shared lock */
|
||||||
UnlockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
|
UnlockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
|
||||||
@@ -261,7 +261,7 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
|
|||||||
*/
|
*/
|
||||||
LockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
|
LockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
|
||||||
|
|
||||||
HnswBench("scan iteration", so->w = ResumeScanItems(scan));
|
so->w = ResumeScanItems(scan);
|
||||||
|
|
||||||
UnlockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
|
UnlockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user