DeusData codebase-memory-mcp Performance Considerations: Benchmarks and Architecture
The DeusData codebase-memory-mcp achieves sub-millisecond graph queries and indexes 28 million lines of code in under three minutes by combining a two-stage parsing pipeline, in-memory SQLite storage with LZ4 compression, and a zero-dependency static binary architecture.
The DeusData codebase-memory-mcp is a high-performance code analysis engine designed for the Model Context Protocol (MCP). Understanding its performance considerations helps developers optimize indexing workflows and query response times when working with repositories ranging from small web applications to massive codebases like the Linux kernel.
Core Performance Architecture
The performance characteristics of DeusData codebase-memory-mcp stem from a four-layer architecture designed to minimize I/O and maximize throughput.
Tree-sitter Syntactic Parsing
The first stage uses Tree-sitter to parse 158 languages syntactically, generating AST nodes for every definition, import, and call. This implementation in internal/cbm/ provides a compact structural view without requiring a full language server, eliminating the overhead of external parser processes.
Hybrid LSP Type Resolution
The second stage employs a Hybrid LSP pass for 11 major languages including Python, TypeScript, Rust, Go, and Java. Unlike traditional language servers that spawn external processes, the engine embeds lightweight C implementations of type-resolution algorithms compatible with tsserver, pyright, and rust-analyzer. This keeps latency low while refining CALLS, IMPORTS, and IMPLEMENTS edges using import graphs and type inference.
RAM-First Indexing with SQLite
Source files are read into memory, LZ4-compressed, and fed into an in-memory SQLite database during the indexing process. All nodes and edges are built in RAM, then a single dump writes the SQLite file and releases memory. This approach eliminates repeated disk I/O and produces a compact database file with approximately 8:1 compression ratios, enabling instant loading for queries. The implementation resides in the store/ directory.
Static Binary Distribution
The entire engine ships as a statically linked executable with no runtime dependencies. The binary includes all 158 grammars and the complete indexing pipeline, allowing the OS or CDN to cache the executable for instant startup without container or interpreter overhead.
Benchmark Results and Query Latency
Performance benchmarks for DeusData codebase-memory-mcp demonstrate linear scaling from small frameworks to operating system kernels.
Indexing Performance:
- Full Linux kernel index (28 million LOC, 75,000 files): approximately 3 minutes, generating 4.8 million nodes and 7.7 million edges
- Fast Linux kernel index (partial): approximately 1 minute 12 seconds, generating 1.9 million nodes
- Django full index: approximately 6 seconds, generating 49,000 nodes and 196,000 edges
Query Latency:
- Cypher query (single-hop traversal): less than 1 millisecond
- Regex name search: less than 10 milliseconds
- Dead-code detection (full graph scan): approximately 150 milliseconds
- Call-path trace (depth = 5): less than 10 milliseconds
These metrics are documented in the Performance section of README.md and measured on modern hardware including Apple M3 Pro machines.
Language Coverage and Accuracy
The benchmark suite in docs/BENCHMARK.md measures question coverage across 63 languages, categorized into three performance tiers:
Excellent Performance (≥ 90% accuracy): Lua, Kotlin, C++, Perl, Objective-C, Groovy, C, Bash, Zig, Swift, CSS, YAML, TOML, HTML, SCSS, HCL, and Dockerfile achieve 100% or 12/12 question pass rates.
Good Performance (75–89% accuracy): Python (87% or 10.5/12), TypeScript, TSX, Go, Rust, Java, R, Dart, JavaScript, Erlang, Elixir, Scala, Ruby, PHP, C#, and SQL fall into this tier with robust Hybrid LSP support.
Functional Performance (< 75% accuracy): OCaml (72%) and Haskell (62%) have lower coverage but remain parseable by the Tree-sitter engine.
Token Efficiency for LLM Integration
When integrated with large language models, DeusData codebase-memory-mcp provides significant cost savings through structural querying. Five structural questions consume approximately 3,400 tokens, whereas naive file-by-file grep approaches require approximately 412,000 tokens. This represents a 99.2% reduction in token usage, dramatically lowering API costs while maintaining semantic accuracy.
Measuring Performance Locally
You can verify these performance characteristics using the CLI with the time utility. The following commands target the entry point in src/main.c and pipeline processing logic:
# Index the Linux kernel and measure elapsed time
time codebase-memory-mcp cli index_repository '{"repo_path":"/usr/src/linux"}'
# Execute a single-hop Cypher traversal (expect <1ms)
time codebase-memory-mcp cli query_graph \
'{"query":"MATCH (f:Function)-[:CALLS]->(g) WHERE f.name=\"init\" RETURN g.name LIMIT 5"}'
# Perform a regex name search (expect <10ms)
time codebase-memory-mcp cli search_graph \
'{"label":"Function","name_pattern":"^handle_.*"}'
# Detect dead code with a full graph scan (expect ~150ms)
time codebase-memory-mcp cli query_graph \
'{"query":"MATCH (f:Function) WHERE NOT EXISTS { (f)<-[:CALLS]-() } RETURN f.name"}'
The pipeline/ directory contains the multi-pass logic that enables these speeds by separating syntactic parsing from semantic analysis.
Summary
- Indexing speed ranges from seconds for medium repositories to minutes for the Linux kernel, utilizing RAM-first processing with LZ4 compression.
- Query latency remains sub-10 milliseconds for most graph traversals, with direct edge lookups completing in under 1 millisecond via the in-memory SQLite store.
- Language accuracy exceeds 90% for 18 languages including C, C++, Python, and Go, with full Hybrid LSP support for the 11 most common programming languages.
- Token efficiency achieves a 99.2% reduction compared to text-based search methods, making it cost-effective for LLM-powered workflows.
- Deployment requires only a static binary with no external dependencies, enabling instant startup and OS-level caching.
Frequently Asked Questions
How long does it take to index large repositories like the Linux kernel?
According to the benchmarks in README.md, indexing the full Linux kernel (28 million lines of code across 75,000 files) takes approximately 3 minutes on modern hardware. A fast partial index completes in roughly 1 minute 12 seconds. Medium-sized frameworks like Django index in approximately 6 seconds.
What is the typical query latency for graph traversals?
Single-hop Cypher traversals complete in less than 1 millisecond. Complex operations like call-path tracing to a depth of 5 finish in under 10 milliseconds, while full graph scans for dead-code detection typically require around 150 milliseconds. These metrics reflect the efficiency of the in-memory SQLite storage layer in store/.
How does the static binary improve startup performance?
The static binary contains all 158 Tree-sitter grammars and the complete Hybrid LSP engine in a single executable. Because there are no runtime dependencies, container overhead, or interpreter startup costs, the binary can be cached by the operating system or CDN for instantaneous execution, as implemented in src/main.c.
Which programming languages have the highest accuracy scores?
Languages in the Excellent tier achieve ≥ 90% accuracy, including C, C++, Lua, Kotlin, Perl, Objective-C, Groovy, Bash, Zig, Swift, and markup languages like CSS and YAML. Python achieves 87% accuracy (10.5/12 questions), while TypeScript, Go, Rust, and Java maintain Good tier performance between 75% and 89%.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →