1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Bench-only counter of single-pair distance evaluations.
//!
//! Compiled only with the `internal-bench` feature: release and default test
//! builds carry zero instrumentation. The counter is a process-global relaxed
//! atomic incremented at the two single-pair distance entry points the query
//! paths funnel through:
//!
//! - [`DistanceEngine::distance`](super::native::distance) impls
//! (`CachedSimdDistance`, `CpuDistance`) — HNSW graph traversal and the
//! batch/prefetch helper built on it;
//! - `HnswIndex::compute_distance` — the brute-force bitmap scan and SIMD
//! reranking paths, which call `simd_native` kernels directly.
//!
//! The count is a *work measure*, not a timer: it is bit-for-bit reproducible
//! across runs and machines for a deterministic corpus (the HNSW level PRNG
//! is fixed-seed), which makes it usable on shared CI runners where
//! wall-clock benchmarks are noise.
//!
//! Corollary: with `internal-bench` enabled, the relaxed atomic increment
//! sits inside the distance hot loop — wall-clock measured under this
//! feature is NOT a benchmark of the real engine. Count with this feature;
//! time without it.
use ;
/// Total single-pair distance evaluations since the last reset.
static DISTANCE_EVALS: AtomicU64 = new;
/// Records one single-pair distance evaluation.
pub
/// Returns the number of single-pair distance evaluations since the last reset.
pub
/// Resets the evaluation counter to zero.
pub