Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

blog: stage-1 index-size write-up — "Cutting the index 28%"

xerj-org71a652e3c1be
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e6e1e6570..14b42345e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -158,8 +158,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
full decoder's fixpoint resolves reference chains while hard-erroring on
cycles. Measured on the 100k `benchmarks/index-size` harness at
LEVEL=balanced against a same-day main control (`results/result-zbs4*-balanced.json`):
- `.seg` **−73.1 %** (1,671,271 → 449,094 B), total durable **−22.7 %**
+ `.seg` **−73.1 %** (1,671,271 → 449,094 B), total durable **−22.6 %**
(5,398,478 → 4,176,300 B); every non-`.seg` extension byte-identical
+ but for a 1 B `.json` manifest delta (47,366 → 47,365)
between the runs. ES-YAML conformance 1380 passed / 0 failed; 10 new
storage unit tests cover typed-int round-trips (nulls, negatives,
i64-extreme clusters), copy-of decode across full/projection/hydration
diff --git a/landing/blog/cutting-the-index-28-percent.html b/landing/blog/cutting-the-index-28-percent.html
new file mode 100644
index 000000000..98cd56866
--- /dev/null
+++ b/landing/blog/cutting-the-index-28-percent.html
@@ -0,0 +1,500 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<title>Cutting the index 28%: dissect first, write Rust second</title>
+<meta name="description" content="Four file-format changes took our 100k-doc index from 5.52 MB to 3.99 MB (−28%), each gated on dissecting real segments first. The losing rows are in the post.">
+<link rel="preconnect" href="https://fonts.googleapis.com">
+<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+<link href="https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@400;700;800;900&family=Inter:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500;700&display=swap" rel="stylesheet">
+<link rel="stylesheet" href="/style.css?v=if9">
+<link rel="stylesheet" href="/blog.css?v=1">
+<!-- seo:begin — generated by scripts/seo/fix_heads.py · do not hand-edit -->
+<link rel="canonical" href="https://xerj.org/blog/cutting-the-index-28-percent">
+<meta property="og:site_name" content="XERJ.ai">
+<meta property="og:type" content="article">
+<meta property="og:title" content="Cutting the index 28%: dissect first, write Rust second">
+<meta property="og:description" content="Four file-format changes took our 100k-doc index from 5.52 MB to 3.99 MB (−28%), each gated on dissecting real segments first. The losing rows are in the post.">
+<meta property="og:url" content="https://xerj.org/blog/cutting-the-index-28-percent">
+<meta property="og:image" content="https://xerj.org/og/xerj-card.png">
+<meta property="og:image:width" content="1200">
+<meta property="og:image:height" content="630">
+<meta property="og:image:alt" content="XERJ.ai — the search engine built for AI agents">
+<meta property="og:locale" content="en_US">
+<meta name="twitter:card" content="summary_large_image">
+<meta name="twitter:title" content="Cutting the index 28%: dissect first, write Rust second">
+<meta name="twitter:description" content="Four file-format changes took our 100k-doc index from 5.52 MB to 3.99 MB (−28%), each gated on dissecting real segments first. The losing rows are in the post.">
+<meta name="twitter:image" content="https://xerj.org/og/xerj-card.png">
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@type": "Organization",
+ "@id": "https://xerj.org/#organization",
+ "name": "XERJ",
+ "alternateName": "XERJ.ai",
+ "url": "https://xerj.org/",
+ "logo": "https://xerj.org/brandbook/xerj-mark.svg",
+ "sameAs": [
+ "https://github.com/xerj-org/xerj"
+ ]
+}
+</script>
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@type": "WebSite",
+ "@id": "https://xerj.org/#website",
+ "name": "XERJ.ai",
+ "url": "https://xerj.org/",
+ "inLanguage": "en",
+ "publisher": {
+ "@id": "https://xerj.org/#organization"
+ }
+}
+</script>
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@type": "Article",
+ "headline": "Cutting the index 28%: dissect first, write Rust second",
+ "description": "Four file-format changes took our 100k-doc index from 5.52 MB to 3.99 MB (−28%), each gated on dissecting real segments first. The losing rows are in the post.",
+ "url": "https://xerj.org/blog/cutting-the-index-28-percent",
+ "image": "https://xerj.org/og/xerj-card.png",
+ "inLanguage": "en",
+ "datePublished": "2026-09-27",
+ "dateModified": "2026-09-27",
+ "author": {
+ "@id": "https://xerj.org/#organization"
+ },
+ "publisher": {
+ "@id": "https://xerj.org/#organization"
+ },
+ "isPartOf": {
+ "@id": "https://xerj.org/#website"
+ },
+ "mainEntityOfPage": {
+ "@type": "WebPage",
+ "@id": "https://xerj.org/blog/cutting-the-index-28-percent"
+ }
+}
+</script>
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@type": "BreadcrumbList",
+ "itemListElement": [
+ {
+ "@type": "ListItem",
+ "position": 1,
+ "name": "Home",
+ "item": "https://xerj.org/"
+ },
+ {
+ "@type": "ListItem",
+ "position": 2,
+ "name": "Blog",
+ "item": "https://xerj.org/blog/"
+ },
+ {
+ "@type": "ListItem",
+ "position": 3,
+ "name": "Cutting the index 28%"
+ }
+ ]
+}
+</script>
+<!-- seo:end -->
+</head>
+<body>
+<nav class="nav" aria-label="Primary">
+ <a href="/" class="brand">XERJ.AI</a>
+ <a href="/">HOME</a>
+ <a href="/product">PRODUCT</a>
+ <span class="nav-drop"><a href="/use-cases">USE CASES</a></span>
+ <a href="/case-studies">CASE STUDIES</a>
+ <a href="/benchmarks/">BENCHMARKS</a>
+ <a href="/blog/" class="active">BLOG</a>
+ <span class="spacer"></span>
+ <a href="/for-agents">FOR AGENTS</a>
+ <a href="/docs/">DOCS</a>
+ <a href="/docs/recipes/">RECIPES</a>
+ <a href="/playground">DASHBOARDS</a>
+ <a href="https://github.com/xerj-org/xerj" rel="external">GITHUB</a>
+ <span class="theme"><button type="button" data-theme="day" class="active">DAY</button><span class="dash">·</span><button type="button" data-theme="night">NIGHT</button></span>
+</nav>
+
+<main>
+<div class="uc-hero">
+ <p class="blog-crumb"><a href="/blog/">&larr; ALL POSTS · /BLOG</a></p>
+ <div class="uc-eyebrow">STORAGE · ON-DISK SIZE · 100K-DOC HARNESS · RUNS 2026-09-26/27</div>
+ <h1>A DISSECTION, FOUR FILE FORMATS,<br><span class="accent">AND 28% OFF THE INDEX</span></h1>
+ <p class="blog-byline">XERJ ENGINEERING · PUBLISHED 2026-09-27</p>
+
+ <p class="lede">We spent two days cutting the on-disk size of a XERJ index by 28 percent —
+ from about 5.52 MB to 3,989,254 bytes on a 100k-document benchmark — and the interesting part is not the
+ number. It is that three of the four format changes we shipped ended up shaped differently from
+ the plans that started them, because we dissected real segment files before writing any Rust,
+ and kept every losing row.</p>
+</div>
+
+<section class="scene-section">
+ <div class="kicker">01 · THE METHOD</div>
+ <h2 class="scene">Dissect first, write Rust second</h2>
+
+ <p>The size work started as an <a href="https://github.com/xerj-org/xerj/issues/1038" rel="external">epic</a>
+ with a waste list written against the code: numeric doc-values stored as raw 8-byte lanes, postings
+ block headers carrying bytes the reader could derive, per-term metadata in fixed 24-byte records,
+ the same keyword strings stored three times per segment. A confident list. Parts of it were wrong,
+ and the way we found out which parts is the method worth writing down.</p>
+
+ <p>Stage zero built a harness,
+ <a href="https://github.com/xerj-org/xerj/tree/main/benchmarks/index-size" rel="external"><code class="inline">benchmarks/index-size</code></a>:
+ 100,000 documents — 4,008 real telemetry events cycled 25 times, each with a timestamp, a model
+ name, token counts, a cost, a tenant, and a body of text — bulk-indexed into a throwaway node,
+ force-merged to a single segment, then a byte census by file family and by field. Every format
+ change in this post landed with its A/B result committed beside it.</p>
+
+ <p>The rule the epic settled on: before writing a codec, copy the segment file out of the data
+ directory and dissect it offline — <code class="inline">python3</code> and the
+ <code class="inline">zstd</code> command line are enough — and predict the payoff from the actual
+ bytes. Only then open the editor. Four formats went through that gate:</p>
+
+ <div class="vt-wrap">
+ <table class="vt">
+ <thead><tr><th>Format change</th><th>Family</th><th>Before &rarr; after (B)</th><th>&Delta;</th></tr></thead>
+ <tbody>
+ <tr><td>ZNV2 · doc-values FOR + bitpack, per-column chooser</td><td class="t">.dv</td><td class="n">390,487 &rarr; 355,156</td><td class="n w">&minus;9.0%</td></tr>
+ <tr><td>ZPS2 · postings frame-of-reference framing</td><td class="t">.post</td><td class="n">2,449,405 &rarr; 2,364,905</td><td class="n w">&minus;3.4%</td></tr>
+ <tr><td>ZBS4 · typed-int stored columns, duplicate refs</td><td class="t">.seg</td><td class="n">1,671,271 &rarr; 449,094</td><td class="n w">&minus;73.1%</td></tr>
+ <tr><td>ZFM5 · columnar varint term metadata</td><td class="t">.meta</td><td class="n">200,826 &rarr; 13,774</td><td class="n w">&minus;93.1%</td></tr>
+ <tr><td><strong>whole index, last two stages (committed pair)</strong></td><td class="t">all</td><td class="n"><strong>5,398,478 &rarr; 3,989,254</strong></td><td class="n w"><strong>&minus;26.1%</strong></td></tr>
+ </tbody>
+ </table>
+ </div>
+
+ <p>Each row is a same-day A/B against a control binary on the same corpus at the balanced
+ compression level, one force-merged segment; the first two stages' tables live in the changelog
+ entries and the last two stages' result files are committed beside the harness. Those last two
+ were also re-measured together on the merged tree — 4,176,306 to 3,989,254 B — and subtracting
+ the <code class="inline">.meta</code> delta from that control reproduces the endpoint to the
+ byte. Sum all four family deltas and the index that entered the epic at roughly 5.52 MB came
+ out at 3,989,254 B: &minus;27.7%, which the headline rounds to 28. The two biggest wins are the
+ two formats the dissection redirected, and they are the middle of this post.</p>
+</section>
+
+<section class="scene-section">
+ <div class="kicker">02 · THE FIRST LESSON</div>
+ <h2 class="scene">The plan lost to plain bytes on our own corpus</h2>
+
+ <p>The first change looked like the safest bet on the list. Numeric doc-value columns were stored
+ as raw 8-byte values per document; the textbook fix is frame-of-reference plus bit-packing —
+ subtract the minimum, divide out the greatest common divisor, pack the residuals into
+ 128-document blocks at the width the spread demands. That is the shape tantivy's columnar store
+ uses, and our unit tests measure monotone strided columns ~5&times; smaller than raw before
+ compression.</p>
+
+ <p>The first cut shipped bitpack-everywhere. The harness rejected it outright: the
+ <code class="inline">.dv</code> family came out at 2.0&times; the baseline — 789,167 B against
+ 390,487. The optimization doubled the size of the thing it was optimizing.</p>
+
+ <p>The reason is the interesting part. The corpus cycles its 4,008 events, so the raw lanes
+ repeat byte-for-byte down the file, and the outer zstd pass matches repeating bytes almost for
+ free. Bit-packing is block-local: every 128-doc block scrambles the byte grid the compressor was
+ matching against. An information-theoretic win lost, on real bytes, to a compressor that could
+ see the whole file.</p>
+
+ <div class="loss">
+ <strong>Bitpack-always: 2.02&times; the .dv size.</strong> The row stays at the top of the
+ losing table because it is the whole argument for the method — the format we were most
+ confident about was the one our own corpus rejected hardest.
+ </div>
+
+ <p>What shipped instead races both candidates per column — the bit-packed layout and the raw one —
+ compresses both at the real level, and keeps whichever is smaller after zstd: the Parquet
+ pick-the-smallest rule. On this worst-case-for-bitpacking corpus it wins 9.0% on
+ <code class="inline">.dv</code> (0.6% of the whole index); on genuinely monotone columns —
+ timestamps, counters — it can win five times as much. The chooser pays both prices and never
+ guesses.</p>
+</section>
+
+<section class="scene-section">
+ <div class="kicker">03 · THE FRAMING TAX</div>
+ <h2 class="scene">Postings: a percent here, a percent there</h2>
+
+ <p>The postings files carry, for every term, the sorted document ids and the term frequencies,
+ packed in 128-document blocks. The blocks were paying a framing tax: a 4-byte length that is a
+ pure function of the bit width, and a residual count the reader can derive on its own. ZPS2
+ re-framed them — <code class="inline">[width][vbyte min]</code>, where width zero means a
+ constant block that carries no payload at all; the positions block lost its length prefix
+ (exactly 128 count-and-delta groups pin its end); and a positioned term whose total term
+ frequency equals its document frequency omits its <em>entire</em> frequency stream, because the
+ reader can re-derive every count as one.</p>
+
+ <p>Measured: <code class="inline">.post</code> &minus;3.4% (2,449,405 &rarr; 2,364,905 B),
+ <code class="inline">body.post</code> &minus;4.3% (1,828,102 &rarr; 1,749,695 B). Small and
+ honest — and the widest keyword family in the corpus (<code class="inline">top_doc</code>,
+ 12 terms at df &asymp; 8.3k) went the other way, +1.5%. Families move in both directions; the
+ family total is what gates the merge.</p>
+</section>
+
+<section class="scene-section">
+ <div class="kicker">04 · THE WHALE</div>
+ <h2 class="scene">The stored section, where the dissection redirected the plan</h2>
+
+ <p>The <code class="inline">.seg</code> file holds the stored documents — the columnar copy of
+ <code class="inline">_source</code>. The epic's plan for it was dictionary work on keyword
+ columns. Then we dissected one: the planned dict-stream work targeted about 5% of the section.
+ The body text's JSON fallback alone was 84.2% of it. The plan was aiming at the wrong end of
+ the file.</p>
+
+ <p>The same dissection showed two cheaper embarrassments:
+ <code class="inline">__seq_no</code> — consecutive integers — stored as ASCII text, five bytes
+ for &ldquo;12345&rdquo;; and <code class="inline">doc_id</code> stored as a byte-identical
+ duplicate of the engine's internal <code class="inline">__id</code> column. Three codecs went
+ in instead of the dictionary work:</p>
+
+ <ul>
+ <li><strong>TYPED_INT</strong> — an all-integer column becomes a presence bitmap plus
+ 128-value frame-of-reference blocks, the same shape as the ZPS2 postings framing, with a
+ zigzag-varint residual for what escapes the blocks. Floats and strings never qualify and keep
+ the JSON fallback.</li>
+ <li><strong>COPY_OF</strong> — a column byte-identical to an earlier column is written as a
+ 4-byte reference, after a digest plus a full equality check. An id echoed into
+ <code class="inline">_source</code> costs 4 bytes instead of a second payload.</li>
+ <li><strong>A long-effort chooser, merge path only</strong> — each JSON-fallback column is
+ additionally compressed at zstd level 19 with long-distance matching and an explicit 16 MB
+ window; the smaller payload wins. Flush stays pinned to level 3, where an earlier measurement
+ showed level 19 is an ingest regression we had no reason to re-learn.</li>
+ </ul>
+
+ <p>Two measured reasons the third codec is a chooser and not a level bump. The window knee is
+ sharp: the 29.8 MB body column compresses to 679 kB at the default window and 330 kB at 16 MB,
+ because the corpus's sentence pool repeats just past a small window. And high levels
+ <em>regress</em> small-alphabet streams: the id column is 54 kB at level 3 and 143 kB at
+ level 19. A global 19 would grow the ids while it shrank the body.</p>
+
+ <p>Result: <code class="inline">.seg</code> &minus;73.1% (1,671,271 &rarr; 449,094 B), the
+ whole index &minus;22.6% in one stage (5,398,478 &rarr; 4,176,300 B). Every other file family
+ is byte-identical between those two runs but for one byte in a manifest counter — the change is
+ fenced to its own envelope, and anything an older codec could already express is still written
+ in that older codec, byte for byte.</p>
+</section>
+
+<section class="scene-section">
+ <div class="kicker">05 · THE EMBARRASSING ONE</div>
+ <h2 class="scene">138.7 KB for about 200 bytes of information</h2>
+
+ <p>The <code class="inline">.meta</code> files hold per-term postings metadata: document
+ frequency, total term frequency, and a pointer into the postings — for every term in the field's
+ dictionary. <code class="inline">doc_id</code> has 100,000 unique terms, and in this corpus
+ every one of them has <code class="inline">ttf == df</code> (each document holds its id once)
+ and every postings gap is zero. The information content of that file is a few hundred bytes.
+ It cost 138,727 B.</p>
+
+ <p>The culprit was the record stride: <code class="inline">{df u32, ttf u64, offset u64,
+ len u32}</code> — 24 fixed bytes per term, interleaved. zstd did compress that stream,
+ seventeen-fold, but it cannot match across the stride's alternating field widths, so every
+ record still cost it residual bytes on the lanes that vary: about 1.4 bytes per term, 138.7 kB
+ across a hundred thousand terms, for a file whose information content is a few hundred
+ bytes.</p>
+
+ <p>The obvious first move — keep the records, delta-encode the fields in place under the
+ envelope — would have kept the stride, and the stride itself was the cost. ZFM5 reshapes the
+ section <em>before</em> compressing it: four
+ columnar varint streams — df, ttf&thinsp;&minus;&thinsp;df (elided entirely when every term in
+ the field has <code class="inline">ttf == df</code>, which is the keyword-field shape), offset
+ gaps, and lengths. zstd sees four long runs of one-symbol lanes instead of 100,000 interleaved
+ records. On the final tree that file is 216 B on disk, envelope header included. The reader expands the streams once at
+ open time into the flat record array the previous formats built, so the term-lookup hot path
+ is untouched.</p>
+
+ <p>One more thing this format earned before it merged. An adversarial review of the diff —
+ independent reviewers told to break the decoder — confirmed exactly one real defect: the
+ total-frequency reconstruction was the only unchecked addition left in the expansion loop, and a
+ crafted delta could wrap it in a release build to <code class="inline">ttf &lt; df</code>,
+ silently flipping the freq-elision predicate from section&nbsp;03. Unreachable from our writer,
+ but a decoder should not trust its writer. Fixed with checked arithmetic and a regression test
+ that feeds it the crafted delta. <code class="inline">.meta</code> finished at
+ &minus;93.1% (200,826 &rarr; 13,774 B).</p>
+
+ <p>The peer anchor is worth naming: tantivy's term dictionary serializes block-leading absolute
+ ranges once and per-term VInt lengths, reconstructing offsets by accumulation — same insight,
+ MIT-licensed, cited beside our implementation of it. The columnar split and the elision flag
+ are ours.</p>
+</section>
+
+<section class="scene-section">
+ <div class="kicker">06 · THE BASELINES</div>
+ <h2 class="scene">Six percent of raw — and the caveat that number needs</h2>
+
+ <p>After the four stages, the index for those 100,000 documents — the whole data directory — is
+ 3,989,254 B. The raw documents are 63,461,256 B of NDJSON, measured off the exact bulk payload
+ the harness indexed. Against the obvious baselines on the same bytes:</p>
+
+ <div class="vt-wrap">
+ <table class="vt">
+ <thead><tr><th>100,000 documents, same bytes</th><th>Size (B)</th><th>% of raw</th></tr></thead>
+ <tbody>
+ <tr><td>raw NDJSON documents</td><td class="n">63,461,256</td><td class="t">&mdash;</td></tr>
+ <tr><td><code class="inline">zstd -19</code> of the raw</td><td class="n">1,571,615</td><td class="n">2.5%</td></tr>
+ <tr><td><code class="inline">gzip -9</code> of the raw</td><td class="n">4,089,793</td><td class="n">6.4%</td></tr>
+ <tr><td><strong>XERJ index, whole data dir</strong></td><td class="n w">3,989,254</td><td class="n w">6.3%</td></tr>
+ <tr><td><code class="inline">zstd -3</code> of the raw (our flush level)</td><td class="n">5,866,915</td><td class="n">9.2%</td></tr>
+ </tbody>
+ </table>
+ </div>
+
+ <p>The index — which answers queries, accepts updates and deletes, and gives random access into
+ every one of those bytes — lands smaller than <code class="inline">gzip -9</code> of the same
+ text. It will never reach <code class="inline">zstd -19</code> of a sequential stream, and it should not be asked to:
+ that row is a compressor with unbounded CPU and no obligation to ever seek.</p>
+
+ <div class="loss">
+ <strong>The caveat, plainly.</strong> This corpus is deliberately repetitive — 4,008 events
+ cycled 25 times over a twelve-sentence body pool. It is a stress harness for format work, not
+ a product ratio. On your corpus the index will be a larger fraction of raw. The deltas in the
+ first table are what transfer; the 6.3% is not. We print it only to anchor the baseline row.
+ </div>
+</section>
+
+<section class="scene-section">
+ <div class="kicker">07 · WHAT'S LEFT</div>
+ <h2 class="scene">Two whales, and a plan for each</h2>
+
+ <p>Where the 3,989,254 B went, from the committed harness result for the final tree (the
+ <code class="inline">.seg</code> family measured 449,094 B in that stage's own A/B — two
+ bytes of run-to-run noise):</p>
+
+ <div class="vt-wrap">
+ <table class="vt">
+ <thead><tr><th>File family</th><th>Bytes</th><th>Share</th><th>What it is</th></tr></thead>
+ <tbody>
+ <tr><td>.post</td><td class="n">2,364,905</td><td class="n">59.3%</td><td class="t">postings — body.post alone is 1,749,695 B</td></tr>
+ <tr><td>.ids</td><td class="n">613,485</td><td class="n">15.4%</td><td class="t">seq_no &rarr; external id map for fast restart</td></tr>
+ <tr><td>.seg</td><td class="n">449,092</td><td class="n">11.3%</td><td class="t">stored columns (_source)</td></tr>
+ <tr><td>.dv</td><td class="n">355,156</td><td class="n">8.9%</td><td class="t">doc values for sorting and aggs</td></tr>
+ <tr><td>.fst</td><td class="n">105,760</td><td class="n">2.7%</td><td class="t">term dictionaries</td></tr>
+ <tr><td>.json + .norms + .meta</td><td class="n">96,809</td><td class="n">2.4%</td><td class="t">manifests, BM25 lengths, term metadata</td></tr>
+ <tr><td>everything else</td><td class="n">4,047</td><td class="n">0.1%</td><td class="t">markers, keys, locks</td></tr>
+ </tbody>
+ </table>
+ </div>
+
+ <p>Two clusters dominate. <strong>Body text is ~2.11 MB, about 53% of the index</strong> —
+ postings for the body field (1,749,695 B), its stored column (328,266 B), its length norms
+ (35,194 B). That is 7.1% of the 29.8 MB of raw body text: text is already near its entropy, and
+ the remaining wins there are incremental framing work. <strong>The id echo is ~0.88 MB, about
+ 22%</strong> — in this corpus <code class="inline">_id</code> and
+ <code class="inline">doc_id</code> are the same string, and it is stored four ways: the
+ <code class="inline">.ids</code> pairs at 613 kB, <code class="inline">doc_id</code>'s own
+ postings at 256 kB, the <code class="inline">__id</code> stored column — 9.4 kB on the merged
+ tree, after stage 1's duplicate-reference and long-effort codecs had their way with it — and
+ term-dictionary slices. That cluster still pays ~45% of its raw bytes, where the body pays
+ 7.1%.</p>
+
+ <p>Stage 2 is dictionary reuse: the full-text term dictionary already <em>is</em> a finished
+ dictionary for keyword fields — today we learn the ids and then store them again in two more
+ places; referencing term ordinals from the other columns deletes the echo. Stage 3 is trained
+ zstd dictionaries for the many-small-files tail. Neither is measured yet, so neither gets a
+ number in this post; when they are, the losing rows will be in that one too.</p>
+</section>
+
+<section class="scene-section">
+ <div class="kicker">08 · THE LOSING ROWS</div>
+ <h2 class="scene">What we tried and kept out</h2>
+
+ <div class="vt-wrap">
+ <table class="vt">
+ <thead><tr><th>Variant</th><th>Measured</th><th>Verdict</th></tr></thead>
+ <tbody>
+ <tr><td>bitpack-always .dv</td><td class="n l">2.02&times; baseline</td><td class="t">per-column chooser ships instead</td></tr>
+ <tr><td>zstd-19, default window, body column</td><td class="n l">679 kB</td><td class="t">330 kB at an explicit 16 MB window — the window is the knob</td></tr>
+ <tr><td>zstd-19 on the id column</td><td class="n l">54 kB &rarr; 143 kB</td><td class="t">regression; effort is chosen per column</td></tr>
+ <tr><td>ZPS2 on the widest keyword family</td><td class="n l">+1.5%</td><td class="t">kept — the family total still wins</td></tr>
+ <tr><td>.meta with the 24-byte stride kept</td><td class="n l">138,727 B for doc_id.meta</td><td class="t">the stride itself was the cost; ZFM5 removes it</td></tr>
+ </tbody>
+ </table>
+ </div>
+
+ <p>Every number in this post traces to a run. The harness and its design notes are committed in
+ <a href="https://github.com/xerj-org/xerj/tree/main/benchmarks/index-size" rel="external">benchmarks/index-size</a>,
+ with the last two stages' result files beside them and the first two stages' A/B tables in the
+ changelog entries; the work is tracked in
+ <a href="https://github.com/xerj-org/xerj/issues/1038" rel="external">epic
+ #1038</a> and landed as pull requests
+ <a href="https://github.com/xerj-org/xerj/pull/1040" rel="external">#1040</a>,
+ <a href="https://github.com/xerj-org/xerj/pull/1041" rel="external">#1041</a>,
+ <a href="https://github.com/xerj-org/xerj/pull/1042" rel="external">#1042</a> and
+ <a href="https://github.com/xerj-org/xerj/pull/1043" rel="external">#1043</a>, each with its own
+ measured table. The wire-compatibility conformance suite stayed green across all four merges —
+ the gate that outranks size.</p>
+
+ <p>If you would rather check the claim than read about it: the engine is
+ <a href="/docs/install">one binary</a>, the harness is in the repository, and your own corpus is
+ the benchmark that matters. The retrieval side of this engine's story is in
+ <a href="/blog/does-xerj-beat-jev">our post on reranking</a> and
+ <a href="/blog/jev-vs-a-bm25-vote">the BM25-vote decisions study</a>; the wire-protocol
+ conformance numbers live on the <a href="/benchmarks/">benchmarks page</a>.</p>
+</section>
+
+</main>
+
+<!-- seo:footer-begin — generated by scripts/seo/fix_links.py · do not hand-edit -->
+<nav class="footer-map" aria-label="Site map">
+ <div class="fm-col">
+ <span class="fm-h">PRODUCT</span>
+ <a href="/product">PRODUCT</a>
+ <a href="/architecture/">ARCHITECTURE</a>
+ <a href="/benchmarks/">BENCHMARKS</a>
+ <a href="/pricing/">PRICING</a>
+ <a href="/security/">SECURITY</a>
+ <a href="/playground">DASHBOARDS</a>
+ <a href="/demo/">REAL-DATA DEMO</a>
+ <a href="/aise-demo">PRODUCT TOUR</a>
+ </div>
+ <div class="fm-col">
+ <span class="fm-h">SOLUTIONS</span>
+ <a href="/solutions/">SOLUTIONS</a>
+ <a href="/use-cases">USE CASES</a>
+ <a href="/case-studies">CASE STUDIES</a>
+ <a href="/industries/">INDUSTRIES</a>
+ <a href="/industries/finserv">FINANCIAL SERVICES</a>
+ <a href="/industries/public-sector">PUBLIC SECTOR</a>
+ <a href="/industries/healthcare">HEALTHCARE</a>
+ <a href="/industries/retail">RETAIL</a>
+ <a href="/use-cases/code-security-audit">AI CODE-SECURITY AUDIT</a>
+ <a href="/use-cases/semantic-analytics">SEMANTIC ANALYTICS</a>
+ </div>
+ <div class="fm-col">
+ <span class="fm-h">DOCS</span>
+ <a href="/docs/">DOCUMENTATION</a>
+ <a href="/docs/quickstart">QUICKSTART</a>
+ <a href="/docs/install">INSTALL</a>
+ <a href="/docs/migration-from-es">MIGRATE FROM ELASTICSEARCH</a>
+ <a href="/docs/recipes/">RECIPES</a>
+ <a href="/docs/agents/">DOCS FOR AI</a>
+ <a href="/for-agents">FOR AI AGENTS</a>
+ <a href="/agent-search/">AGENTIC SEARCH DEMO</a>
+ <a href="/answers/">ANSWERS</a>
+ <a href="/compare/">COMPARISONS</a>
+ </div>
+ <div class="fm-col">
+ <span class="fm-h">RESOURCES</span>
+ <a href="/resources/">SALES KIT</a>
+ <a href="/blog/">BLOG</a>
+ <a href="/brand">BRAND</a>
+ <a href="/brandbook/">BRAND BOOK</a>
+ <a href="/llms.txt">LLMS.TXT</a>
+ <a href="https://github.com/xerj-org/xerj" rel="external">GITHUB</a>
+ </div>
+</nav>
+<!-- seo:footer-end -->
+<footer class="footer">
+ <span>XERJ.AI · V1.0.0-RC.77 · 2026</span>
+ <span>SEARCH FOR THE AGENT ERA</span>
+ <span><a href="/product">PRODUCT</a> · <a href="/docs/">DOCS</a> · <a href="/brand">BRAND</a> · <a href="/playground">DASHBOARDS</a> &middot; <a href="/llms.txt">LLMS.TXT</a></span>
+</footer>
+<script src="/interact.js" defer></script>
+</body>
+</html>
diff --git a/landing/blog/index.html b/landing/blog/index.html
index dc47def5e..569576c7b 100644
--- a/landing/blog/index.html
+++ b/landing/blog/index.html
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>XERJ.ai — Blog: the engineering log</title>
-<meta name="description" content="Measured results with the losses left in: the Jev decisions study, the JEV rerank verdict, and benchmark autopsies that name the runs behind every number.">
+<meta name="description" content="Measured results with the losses left in: the Jev decisions study, the JEV rerank verdict, benchmark autopsies, and the storage formats that cut the index 28%.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@400;700;800;900&family=Inter:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap" rel="stylesheet">
@@ -16,7 +16,7 @@
<meta property="og:site_name" content="XERJ.ai">
<meta property="og:type" content="website">
<meta property="og:title" content="XERJ.ai — Blog: the engineering log">
-<meta property="og:description" content="Measured results with the losses left in: the Jev decisions study, the JEV rerank verdict, and benchmark autopsies that name the runs behind every number.">
+<meta property="og:description" content="Measured results with the losses left in: the Jev decisions study, the JEV rerank verdict, benchmark autopsies, and the storage formats that cut the index 28%.">
<meta property="og:url" content="https://xerj.org/blog/">
<meta property="og:image" content="https://xerj.org/og/xerj-card.png">
<meta property="og:image:width" content="1200">
@@ -25,7 +25,7 @@
<meta property="og:locale" content="en_US">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="XERJ.ai — Blog: the engineering log">
-<meta name="twitter:description" content="Measured results with the losses left in: the Jev decisions study, the JEV rerank verdict, and benchmark autopsies that name the runs behind every number.">
+<meta name="twitter:description" content="Measured results with the losses left in: the Jev decisions study, the JEV rerank verdict, benchmark autopsies, and the storage formats that cut the index 28%.">
<meta name="twitter:image" content="https://xerj.org/og/xerj-card.png">
<script type="application/ld+json">
{
@@ -59,11 +59,11 @@
"@context": "https://schema.org",
"@type": "CollectionPage",
"name": "XERJ.ai — Blog: the engineering log",
- "description": "Measured results with the losses left in: the Jev decisions study, the JEV rerank verdict, and benchmark autopsies that name the runs behind every number.",
+ "description": "Measured results with the losses left in: the Jev decisions study, the JEV rerank verdict, benchmark autopsies, and the storage formats that cut the index 28%.",
"url": "https://xerj.org/blog/",
"image": "https://xerj.org/og/xerj-card.png",
"inLanguage": "en",
- "dateModified": "2026-09-21",
+ "dateModified": "2026-09-27",
"isPartOf": {
"@id": "https://xerj.org/#website"
},
@@ -126,6 +126,58 @@
<!-- Reverse-chronological by hand while there is one post; new posts PREPEND.
Move to a generator only past ~10 posts. -->
<ol class="blog-list">
+ <li>
+ <a class="bl-card" href="/blog/cutting-the-index-28-percent">
+ <!-- Bar widths share ONE denominator, 2,449 kB (the max across all rows,
+ .post before), so lengths compare across rows. Neutral bar = the
+ stage-0 baseline, accent bar = after that family's format change.
+ Figures verbatim from the post: .post 2,449/2,365 kB · .seg
+ 1,671/449 kB · .dv 390/355 kB · .meta 200.8/13.8 kB (the 2 px
+ sliver is the real ratio). -->
+ <div class="bl-preview" aria-hidden="true">
+ <div class="blp-kicker">ON-DISK SIZE · 4 FILE FORMATS · 100K DOCS</div>
+ <div class="blp-row">
+ <div class="blp-ds">.POST</div>
+ <div class="blp-pair">
+ <span class="blp-num">2,449 kB <i>before</i></span><span class="blp-bar b" style="width:100%"></span>
+ <span class="blp-num">2,365 kB <i>after</i></span><span class="blp-bar a" style="width:96.6%"></span>
+ </div>
+ </div>
+ <div class="blp-row">
+ <div class="blp-ds">.SEG</div>
+ <div class="blp-pair">
+ <span class="blp-num">1,671 kB <i>before</i></span><span class="blp-bar b" style="width:68.2%"></span>
+ <span class="blp-num">449 kB <i>after</i> <span class="blp-chip">&minus;73.1%</span></span><span class="blp-bar a" style="width:18.3%"></span>
+ </div>
+ </div>
+ <div class="blp-row">
+ <div class="blp-ds">.DV</div>
+ <div class="blp-pair">
+ <span class="blp-num">390 kB <i>before</i></span><span class="blp-bar b" style="width:15.9%"></span>
+ <span class="blp-num">355 kB <i>after</i></span><span class="blp-bar a" style="width:14.5%"></span>
+ </div>
+ </div>
+ <div class="blp-row">
+ <div class="blp-ds">.META</div>
+ <div class="blp-pair">
+ <span class="blp-num">200.8 kB <i>before</i></span><span class="blp-bar b" style="width:8.2%"></span>
+ <span class="blp-num">13.8 kB <i>after</i> <span class="blp-chip">&minus;93.1%</span></span><span class="blp-bar a" style="width:0.6%"></span>
+ </div>
+ </div>
+ <p class="blp-foot">stage 1: ~5.52 MB &rarr; 3.99 MB (&minus;28%) · committed control pair 5,398,478 &rarr; 3,989,254 B</p>
+ </div>
+ <div class="bl-meta">
+ <p class="bl-date"><time datetime="2026-09-27">2026-09-27</time> · STORAGE · ENGINEERING</p>
+ <h2 class="bl-title">Cutting the index 28%: dissect first, write Rust second</h2>
+ <p class="bl-excerpt">Four file formats, each changed only after a real segment was dissected offline.
+ The stored section fell <strong>&minus;73.1%</strong>, term metadata <strong>&minus;93.1%</strong>, and
+ the whole index went from <strong>5.52 MB to 3.99 MB</strong>. The variant we were most confident
+ about doubled the size it was improving &mdash; that row is in the post too.</p>
+ <p class="bl-byline">AUTHOR · XERJ ENGINEERING TEAM · PUBLISHED · 2026-09-27</p>
+ <span class="bl-read">READ THE POST &rarr;</span>
+ </div>
+ </a>
+ </li>
<li>
<a class="bl-card" href="/blog/jev-vs-a-bm25-vote">
<!-- Bar widths share ONE denominator, 0.9880 (the max across all rows),
diff --git a/landing/sitemap.xml b/landing/sitemap.xml
index 24f79d2f9..d6253d145 100644
--- a/landing/sitemap.xml
+++ b/landing/sitemap.xml
@@ -334,7 +334,11 @@
</url>
<url>
<loc>https://xerj.org/blog/</loc>
- <lastmod>2026-09-22</lastmod>
+ <lastmod>2026-09-27</lastmod>
+ </url>
+ <url>
+ <loc>https://xerj.org/blog/cutting-the-index-28-percent</loc>
+ <lastmod>2026-09-27</lastmod>
</url>
<url>
<loc>https://xerj.org/blog/does-xerj-beat-jev</loc>
diff --git a/scripts/seo/pagedata.py b/scripts/seo/pagedata.py
index eaab85cf0..76fd3eedc 100755
--- a/scripts/seo/pagedata.py
+++ b/scripts/seo/pagedata.py
@@ -113,11 +113,19 @@ PAGES: dict[str, dict[str, str]] = {
description="500 decisions each on SMS Spam and Banking77: a tie on spam (McNemar p=0.75), a 9-point retrieval win on 77-way intent at zero cost, and one dataset Jev wins.",
published="2026-09-22", updated="2026-09-22",
),
+ # Size-epic stage-1 write-up, 2026-09-27. published/updated pinned like the
+ # two posts above; in-body run dates stay 2026-09-26/27.
+ "blog/cutting-the-index-28-percent.html": dict(
+ label="Cutting the index 28%", kind="article",
+ title="Cutting the index 28%: dissect first, write Rust second",
+ description="Four file-format changes took our 100k-doc index from 5.52 MB to 3.99 MB (−28%), each gated on dissecting real segments first. The losing rows are in the post.",
+ published="2026-09-27", updated="2026-09-27",
+ ),
"blog/index.html": dict(
label="Blog", kind="collection",
title="XERJ.ai — Blog: the engineering log",
- description="Measured results with the losses left in: the Jev decisions study, the JEV rerank verdict, and benchmark autopsies that name the runs behind every number.",
- updated="2026-09-22",
+ description="Measured results with the losses left in: the Jev decisions study, the JEV rerank verdict, benchmark autopsies, and the storage formats that cut the index 28%.",
+ updated="2026-09-27",
),
"demo/index.html": dict(
label="Real-data demo", kind="software",