Performance
All measurements are from an Apple M4 (10 cores — 4 performance + 6 efficiency, 16 GB RAM, macOS 26) using the hardening harness (scripts/harden.sh), which clones upstream repos fresh and indexes them. Warm, steady-state numbers; the first scan is slower (cold I/O). Re-scans only touch what changed, so keeping a project up to date is far faster.
Scan Speed
Section titled “Scan Speed”Measured with the hardening harness, which clones each project fresh, then runs basemind scan:
| Project | Files | Languages | Scan time |
|---|---|---|---|
| gin | 130 | Go | 0.1 s |
| requests | 128 | Python | 0.1 s |
| ripgrep | 221 | Rust | 0.6 s |
| tokio | 861 | Rust | 0.4 s |
| react | 7 242 | TS / JSX | 2.0 s |
| django | 7 065 | Python | 2.4 s |
| TypeScript compiler | 81 324 | TS / JS / JSON | 18 s |
The TypeScript compiler is the worst case — 81k files in 18 seconds. This is dominated by tree-sitter parsing (~30% of time) and per-file index commits (~14% mutex contention on Fjall). Blob I/O and serialization consume ~16%. Allocations are under 2%.
The table above comes from the hardening harness on upstream repositories, measured on an earlier release; it does not reflect the code-only code map (prose, data and config files now go to the document tier) or the memory-bounded scan. For a large monorepo see Large-monorepo numbers below.
Once the daemon has the index open, code questions answer from a bounded outline cache, resident name indexes and an on-disk index rather than by re-reading the project.
Document Search
Section titled “Document Search”Document indexing and semantic search (PDFs, Office, HTML, images, email) adds a separate pass after code scanning. Full-text + semantic queries over the document index measured 106 ms p50 and 260 ms p95 in-process on a 74k-file monorepo with documents indexed (60 queries).
Git-History Queries
Section titled “Git-History Queries”basemind precomputes a per-repo git-history index — posting lists mapping paths to commits (newest-first) — so the history tools are posting-list lookups rather than tree walks.
Warm, in-process query latency on the same M4:
| Repo | Commits | git_log with path |
git_log recent |
index build | index size |
|---|---|---|---|---|---|
| django | 2 000 | 39 µs | 15 µs | 0.5 s | 1.7 MB (6 % of .git) |
| tokio | 3 984 | 37 µs | 13 µs | 0.9 s | 2.1 MB (12 %) |
| requests | 6 480 | 38 µs | 15 µs | 1.0 s | 1.9 MB (14 %) |
| TypeScript | 2 000 | 37 µs | 13 µs | 3.2 s | 30 MB (12 %) |
History queries answer in tens of microseconds, flat across history depth, because the newest-first posting lists decode only the commits a query returns.
The index builds in well under a second to a few seconds and costs 6–22 % of .git on disk.
Index Freshness & Fallback
Section titled “Index Freshness & Fallback”The index is a pure accelerator: the tools use it only when fresh (last_indexed_head == HEAD) and otherwise walk history directly. This means:
- The index can never serve stale results.
- It rebuilds automatically when history is rewritten (filter-repo, rebase, force-push).
- There are no consistency risks — the index is optional.
To measure: cargo bench --bench git_history or the git-ops block in scripts/harden.sh.
Query Latency Summary
Section titled “Query Latency Summary”With the daemon holding the index (in-process p50 on a 74k-file monorepo, see below):
- Outline: about 1 ms
- Symbols, references, callers, dependents: 1-5 ms
code_grep: low hundreds of ms with the bloom prefilter, several seconds without- Git history (
git_logrecent and bypath): tens of µs (posting-list lookup) - Git commit search (
git_logwithquery): ~55 ms - Document search: ~100 ms
These are in-process figures. They exclude MCP transport and process start-up, so an MCP client sees slightly more.
Large-monorepo numbers
Section titled “Large-monorepo numbers”Measured by basemind admin eval --warmup (see Evaluation) on a 74k-file
monorepo, 60 tasks per mode, in-process:
| Mode | p50 | p95 |
|---|---|---|
outline |
1.0 ms | 2.2 ms |
references |
1.4 ms | 6.0 ms |
symbols |
3.7 ms | 5.3 ms |
dependents |
4.0 ms | 5.6 ms |
callers |
4.6 ms | 10.4 ms |
find |
6.6 ms | 9.0 ms |
git_search |
55 ms | 96 ms |
docs |
106 ms | 260 ms |
Scan cost on the 83k-file checkout of the same repository (ADR-0012), peak RSS: a full rebuild after a schema migration peaked at 3.68 GB with the grep bloom filters (4.96 GB without them in the same comparison), and an unchanged rescan at 1.06-1.14 GB (1.15 GB without). Full-rebuild CPU time rose about 3 % (2,355 s against 2,277 s user plus system); rescan CPU was unchanged.
Code grep
Section titled “Code grep”code_grep is a full-corpus scan, so its cost used to be the time to open every indexed file. A
per-file trigram bloom filter (a new grep_bloom index keyspace, about 12.8 % of the indexed code
bytes, built from bytes the scan already reads) lets a grep skip every file that provably cannot contain
a literal the pattern requires. On 15 benchmark patterns over 38,265 Python files (216 MB) of that
monorepo, interleaved runs measured (ADR-0012):
| Run | p50 | p95 | Precision / recall |
|---|---|---|---|
| prefilter off | 3.6-7.8 s | 4.4-9.9 s | 0.906 / 1.000 |
| prefilter on | 125-134 ms | 190-268 ms | 0.906 / 1.000 |
The machine was under heavy unrelated load, so absolute times are inflated; the ranking and the
results were identical across all runs. Results, totals, hit order, cursors and context lines are
unchanged by the prefilter. A file is skipped only when its filter rejects the pattern and its size
and mtime still match the scan. Patterns with no required 3-byte literal (.*, (?i)k) still sweep
everything. BASEMIND_GREP_BLOOM=0 forces the full sweep. An index built before the filters existed
needs no wipe: it greps correctly at once and gains its filters on the next scan. On this repository
(code only, a fresh index) the filters added about 1.9 % to the index size.
Memory Usage
Section titled “Memory Usage”Memory is bounded rather than proportional to repository size: a capped outline cache
([resources] max_map_cache_mb), a compact resident term index, small name dictionaries, a footprint
ceiling on document extraction and embedding, and the CPU ONNX provider by default. See
Memory and resources. basemind cache stats reports both the on-disk cache
(per-component, matching du) and process RAM for your project.
Scaling
Section titled “Scaling”Performance is stable across project size:
- Scan time scales roughly linearly with file count (tree-sitter parsing dominates).
- Git query latency stays flat in history depth: the newest-first posting lists decode only the commits a query returns.
- Git-history index costs 6–22 % of
.giton disk (the one index size that is measured).
Eager L2 (call-site extraction) is on by default and adds to scan time. Set eager_l2 = false to
skip it for faster scans, at the cost of disabling reference search.
Re-scan Performance
Section titled “Re-scan Performance”basemind watch and live-watched re-scans only process changed files:
- Unchanged files are skipped via their content hash — identical content is never reprocessed.
- For changed files, only affected index entries are updated (read-before-write batch).
- Keeping the index fresh is far faster than the first scan, since only changed files are touched.
Hardening Harness
Section titled “Hardening Harness”The tests/harden.rs integration test clones 8 real OSS repos and exercises the full tool sweep:
cargo test --release --test harden -- --ignored --nocaptureIt runs:
- Full scan on each repo
- Every code tool (
code_symbols,code_refs,code_grep, etc.) - The git tools (
git_log,git_blame,git_diff) - Git-history index build and query latency measurements
Per-repo metrics land in /tmp/basemind-harden-*.log. The harness asserts canaries:
tokio:code_refs("spawn")≥ 50,find_files("src")≥ 100,code_grep("fn spawn")≥ 20,code_refs("Future", implementations)≥ 20,code_search("spawn a task")≥ 1django:code_refs("get")≥ 50,git_log(query="fixed")≥ 20 commits,git_log(path="django/db/models/query.py")≥ 10 commits, author search ≥ 1 hitreact:code_symbols("useState")> 0ripgrep-shallow: shallow-clone signal surfaces (any_truncated == true)
Every threshold sits well below the limit its capture call passes, so a canary can never be
satisfied merely by hitting the cap — and never fails because upstream churn moved a count.
Regressions beyond ~20% on scan-time or index-build-time baselines should be investigated before merge.