Files
gitlore/tests/perf_benchmark.rs
Taylor Eernisse a573d695d5 test(perf): add benchmarks for hash query elimination and embed bytes
Two new microbenchmarks measuring optimizations applied in this session:

bench_redundant_hash_query_elimination:
  Compares the old 2-query pattern (get_existing_hash + full SELECT)
  against the new single-query pattern where upsert_document_inner
  returns change detection info directly. Uses 100 seeded documents
  with 10K iterations, prepare_cached, and black_box to prevent
  elision.

bench_embedding_bytes_alloc_vs_reuse:
  Compares per-call Vec<u8> allocation against the reusable embed_buf
  pattern now used in store_embedding. Simulates 768-dim embeddings
  (nomic-embed-text) with 50K iterations. Includes correctness
  assertion that both approaches produce identical byte output.

Both benchmarks use informational-only timing (no pass/fail on speed)
with correctness assertions as the actual test criteria, ensuring they
never flake on CI.

Notes recorded in benchmark file:
- SHA256 hex formatting optimization measured at 1.01x (reverted)
- compute_list_hash sort strategy measured at 1.02x (reverted)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 22:43:11 -05:00

19 KiB