Files
ruvnet__ruflo/v3/@claude-flow/memory/vitest.bench.config.ts
ruv ed95d67822 feat(memory): #2061 ADR-125 Phase 6 — runnable benchmarks + baseline results
Previously `npm run bench` matched no files because `vitest.config.ts`
restricts include to `src/**/*.test.ts`. ADR-125 Phase 6 lands a dedicated
`vitest.bench.config.ts` that discovers `benchmarks/**/*.bench.ts`, and
the `bench` script now points at it.

Additions:
- `vitest.bench.config.ts` — bench discovery config; legacy custom-framework
  bench files (cache-hit-rate, hnsw-indexing, memory-write, vector-search)
  are excluded for now and will be ported in a follow-up alongside Phase 3.
- `benchmarks/hnsw-search.bench.ts` — first real vitest `bench()` suite.
  Measures `HNSWIndex.search` (k=10, k=50) and `addPoint` against 1k random
  128-dim vectors.
- `benchmarks/results/baseline-20260519T212453Z.md` — first measured baseline,
  committed so the README perf table has a real referent.
- `benchmarks/results/scripts/run-baseline.mjs` — companion script that
  produces the JSON blob the baseline.md references.

Measured baseline on Darwin / M-series:
  build_time_ms: 533.42      (1k vectors, 128-dim)
  search_k10_avg_ms: 0.5294  (~1.9k ops/s)
  search_k50_avg_ms: 0.5235
  add_avg_ms: 0.8656

378 tests still passing — no regression.

Refs: ADR-125 Phase 6
Closes: part of #2061

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-19 17:26:26 -04:00

39 lines
1.4 KiB
TypeScript

/**
* Vitest benchmark configuration (ADR-125 Phase 6).
*
* The main `vitest.config.ts` only includes `src/**\/*.test.ts`, which means
* `npm run bench` previously matched nothing. This config exists so
* `vitest bench --config vitest.bench.config.ts` discovers and runs the
* `benchmarks/**\/*.bench.ts` suites that ship with the package.
*
* @see {@link ../docs/adr/ADR-125-memory-consolidation.md} Phase 6.
*/
import { defineConfig } from 'vitest/config';
// Excluded — these legacy bench files use a custom `BenchmarkRunner` framework
// rather than vitest `bench()` blocks. They are still runnable via `tsx` but
// don't fit vitest's discovery model. They are kept on-disk as reference and
// will be ported in a follow-up alongside ADR-125 Phase 3 (persistent HNSW).
const LEGACY_BENCHES = [
'benchmarks/cache-hit-rate.bench.ts',
'benchmarks/hnsw-indexing.bench.ts',
'benchmarks/memory-write.bench.ts',
'benchmarks/vector-search.bench.ts',
];
export default defineConfig({
test: {
environment: 'node',
include: ['benchmarks/**/*.bench.ts'],
exclude: ['node_modules', 'dist', 'benchmarks/longmemeval/**', ...LEGACY_BENCHES],
testTimeout: 60_000,
hookTimeout: 30_000,
globals: false,
typecheck: { enabled: false },
benchmark: {
include: ['benchmarks/**/*.bench.ts'],
exclude: ['node_modules', 'dist', 'benchmarks/longmemeval/**', ...LEGACY_BENCHES],
},
},
});