Rename the project from "obikmer" to "obiskim" across all documentation, user guides, and developer notes. Add extensive new theoretical and implementation documentation covering chance sharing, sibling partition unification, pair-coverage sampling, MPHF batch queries, merge scaling, and hot resume/memoization. Update navigation structures to reflect these new topics and the new project name. - Rename "obikmer" to "obiskim" in all HTML titles, headers, navigation labels, and code examples across `DevDoc/` and `doc/` directories. - Add new navigation links for "Chance sharing across genomes", "Sibling partition unification", "Pair-coverage-biased family sampling", "MPHF batch queries", "Merge mmap audit", "Merge scaling", and "Hot resume and memoization" throughout the documentation site. - Move `DevDoc/architecture/numa_worker_pools/index.html` to `DevDoc/architecture/hot_resume_memoization/index.html` and update content to focus on hot resume and memoization strategies. - Move `DevDoc/implementation/evidence_elimination/index.html` to `DevDoc/implementation/merge_mmap_audit/index.html` and update content to detail merge mmap audit findings and plans. - Move `DevDoc/implementation/superkmer.refs/index.html` to `DevDoc/implementation/merge_scaling/index.html` and update content to discuss merge scaling costs and dependencies. - Move `DevDoc/theory/indexing/index.html` to `DevDoc/theory/chance_sharing/index.html` and rewrite content to discuss chance sharing across genomes and null models. - Move `DevDoc/theory/minimizer/index.html` to `DevDoc/theory/sibling_partition_unification/index.html` and update content to discuss sibling partition unification and Can3 masked canonical form. - Add new `DevDoc/implementation/mphf_batch_queries/index.html` documenting MPHF batch query performance and inventory. - Add new `DevDoc/theory/pair_coverage_sampling/index.html` documenting pair-coverage-biased family sampling theory and diagnostics. - Update `DevDoc/architecture/query/index.html` to describe `by_partition` using `Vec<PartitionKmers>` instead of `HashMap` for reduced memory usage. - Update `DevDoc/implementation/merge/index.html` to describe bootstrap output logic selecting base source by largest `unitigs.bin` size and using `MatrixBuilder::resume`. - Update `DevDoc/implementation/unitig_evidence/index.html` to change `MAX_KMERS_PER_CHUNK` from 256 to 128 and update rank field documentation. - Update `DevDoc/implementation/obipipeline/index.html` to reflect that `obiskim` uses `make_pipe!` and `.apply()` instead of `make_pipeline!` / `WorkerPool`. - Update `DevDoc/implementation/filtering/index.html` to change `FilterArgs` inheritance to `obiskim::cmd::predicate::FilterArgs`. - Update `DevDoc/implementation/partition_layer_cache/index.html` to reflect new crate dependency structure requiring external reachability for algorithm implementation traits. - Update `doc/formats/index_layout/index.html` to describe new directory structure for index files including `part_NNNNN/index/layer_X/` and updated merging/packing logic. - Update `doc/formats/vcf/index.html` to use `obiskim` prefixes for contigs and update VCF header source. - Update `doc/usage/estimate/index.html` to add "Comparing an index with random sharing" section and clarify `--index` and `--presence-threshold` options. - Update `doc/usage/phylo/index.html` to clarify that running `obiskim phylo` twice draws independent samples and update `--sibling-annex` behavior. - Update `doc/usage/select/index.html` to clarify that `select` always writes to a new output directory and explains hard-linking mechanism. - Add new BibTeX entries for Karlin et al. and Bennett et al. in `doc/references.bib`. - Delete `scripts/smoke_test_index2.sh` which contained end-to-end smoke tests for `obikmer2 index` and `obikmer query`. - Update `src/Cargo.lock` to bump "obiskim" package dependency from 1.4.8 to 1.4.9.
2850 lines
92 KiB
HTML
2850 lines
92 KiB
HTML
|
|
<!doctype html>
|
|
<html lang="en" class="no-js">
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
|
|
|
|
|
|
|
|
<link rel="prev" href="../mphf/">
|
|
|
|
|
|
<link rel="next" href="../unitig_evidence/">
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="icon" href="../../assets/images/favicon.png">
|
|
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.6">
|
|
|
|
|
|
|
|
<title>MPHF batch queries (inventory) - obiskim</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../../assets/stylesheets/main.484c7ddc.min.css">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
|
|
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
|
|
|
|
|
|
|
|
<script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
|
|
|
|
|
|
|
|
|
|
|
|
</head>
|
|
|
|
|
|
<body dir="ltr">
|
|
|
|
|
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
|
<label class="md-overlay" for="__drawer"></label>
|
|
<div data-md-component="skip">
|
|
|
|
|
|
<a href="#mphf-batch-queries-site-inventory-and-expected-gains" class="md-skip">
|
|
Skip to content
|
|
</a>
|
|
|
|
</div>
|
|
<div data-md-component="announce">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<header class="md-header md-header--shadow" data-md-component="header">
|
|
<nav class="md-header__inner md-grid" aria-label="Header">
|
|
<a href="../.." title="obiskim" class="md-header__button md-logo" aria-label="obiskim" data-md-component="logo">
|
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
|
|
|
|
</a>
|
|
<label class="md-header__button md-icon" for="__drawer">
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
|
|
</label>
|
|
<div class="md-header__title" data-md-component="header-title">
|
|
<div class="md-header__ellipsis">
|
|
<div class="md-header__topic">
|
|
<span class="md-ellipsis">
|
|
obiskim
|
|
</span>
|
|
</div>
|
|
<div class="md-header__topic" data-md-component="header-topic">
|
|
<span class="md-ellipsis">
|
|
|
|
MPHF batch queries (inventory)
|
|
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
|
|
|
|
|
|
|
|
|
|
</nav>
|
|
|
|
</header>
|
|
|
|
<div class="md-container" data-md-component="container">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<main class="md-main" data-md-component="main">
|
|
<div class="md-main__inner md-grid">
|
|
|
|
|
|
|
|
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
|
|
<div class="md-sidebar__scrollwrap">
|
|
<div class="md-sidebar__inner">
|
|
|
|
|
|
|
|
|
|
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
|
|
<label class="md-nav__title" for="__drawer">
|
|
<a href="../.." title="obiskim" class="md-nav__button md-logo" aria-label="obiskim" data-md-component="logo">
|
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
|
|
|
|
</a>
|
|
obiskim
|
|
</label>
|
|
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../.." class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Home
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../installation/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Installation
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--nested">
|
|
|
|
|
|
|
|
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" >
|
|
|
|
|
|
<label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Theory
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span class="md-nav__icon md-icon"></span>
|
|
</label>
|
|
|
|
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
|
|
<label class="md-nav__title" for="__nav_3">
|
|
<span class="md-nav__icon md-icon"></span>
|
|
|
|
|
|
Theory
|
|
|
|
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../kmers/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Kmers and super-kmers
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../theory/encoding/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
DNA encoding
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../theory/entropy/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Entropy filter
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../theory/minimizer/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Minimizer selection
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../theory/indexing/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Partitioning architecture
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../theory/chance_sharing/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Chance sharing across genomes (discussion)
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../theory/evolutionary_distances/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Central-position SNP distance (discussion)
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../theory/sibling_partition_unification/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Sibling partition unification (discussion)
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../theory/pair_coverage_sampling/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Pair-coverage-biased family sampling (discussion)
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
|
|
|
|
|
|
|
|
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4" checked>
|
|
|
|
|
|
<label class="md-nav__link" for="__nav_4" id="__nav_4_label" tabindex="0">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Implementation
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span class="md-nav__icon md-icon"></span>
|
|
</label>
|
|
|
|
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="true">
|
|
<label class="md-nav__title" for="__nav_4">
|
|
<span class="md-nav__icon md-icon"></span>
|
|
|
|
|
|
Implementation
|
|
|
|
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../superkmer/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
SuperKmer
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../kmer/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Kmer
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../chunkreader/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Chunk reader
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../pipeline/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Construction pipeline
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../obipipeline/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
obipipeline library
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../storage/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
On-disk storage
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../mphf/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
MPHF selection
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--active">
|
|
|
|
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
|
|
|
|
|
|
|
|
|
|
|
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
MPHF batch queries (inventory)
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span class="md-nav__icon md-icon"></span>
|
|
</label>
|
|
|
|
<a href="./" class="md-nav__link md-nav__link--active">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
MPHF batch queries (inventory)
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<label class="md-nav__title" for="__toc">
|
|
<span class="md-nav__icon md-icon"></span>
|
|
Table of contents
|
|
</label>
|
|
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#1-what-ptr_hash-212-actually-offers-read" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
1. What ptr_hash 2.1.2 actually offers [read]
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#2-existing-batch-apis-that-are-not-batched-read" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
2. Existing "batch" APIs that are not batched [read]
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#3-cost-chain-of-a-membership-query-mphflayerfind-read" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
3. Cost chain of a membership query (MphfLayer::find) [read]
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#4-call-site-inventory" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
4. Call-site inventory
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#5-interactions" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
5. Interactions
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#6-benchmark" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
6. Benchmark
|
|
|
|
</span>
|
|
</a>
|
|
|
|
<nav class="md-nav" aria-label="6. Benchmark">
|
|
<ul class="md-nav__list">
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#throwaway-prod-scale-benchmark-not-written" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
Throwaway prod-scale benchmark (not written)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#7-not-verified" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
7. Not verified
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#8-first-improvement-and-measurements-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
8. First improvement and measurements (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#9-benchmark-procedure" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
9. Benchmark procedure
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#10-second-step-construction-pass-2-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
10. Second step — construction pass 2 (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#11-why-the-two-changes-gain-so-little-profiling-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
11. Why the two changes gain so little (profiling, 2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#12-calibration-a-single-skim-at-fewer-partitions-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
12. Calibration: a single skim at fewer partitions (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#13-query-on-a-real-scale-index-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
13. Query on a real-scale index (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#14-index-open-memory-idx-offsets-and-dict_values-mapped-not-copied-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
14. Index-open memory: .idx offsets and dict_values mapped, not copied (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#15-unbuffered-reads-indexmeta-and-superkmer-files-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
15. Unbuffered reads: index.meta and superkmer files (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#16-profile-of-index-on-e-coli-reads-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
16. Profile of index on E. coli reads (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#17-profile-of-index-on-a-skim-vaccinium-vitis-idaea-21-gb-partitions-16-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
17. Profile of index on a skim: Vaccinium vitis-idaea, 2.1 GB, --partitions 16 (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#18-de-bruijn-graph-hasher-walk-and-an-orientation-bug-that-fragmented-unitigs-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
18. De Bruijn graph: hasher, walk, and an orientation bug that fragmented unitigs (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#19-rank-field-unitig-chunks-capped-at-128-k-mers-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
19. Rank field: unitig chunks capped at 128 k-mers (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#20-summary-of-what-was-gained-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
20. Summary of what was gained (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
<nav class="md-nav" aria-label="20. Summary of what was gained (2026-10-15)">
|
|
<ul class="md-nav__list">
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#speed" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
Speed
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#memory-peak-rss-footprint" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
Memory (peak RSS / footprint)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#index-size-newly-built-indexes-existing-ones-are-unchanged" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
Index size (newly built indexes; existing ones are unchanged)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#correctness-fixes-found-on-the-way" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
Correctness fixes found on the way
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#what-is-not-established" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
What is not established
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#21-dead-code-removed-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
21. Dead code removed (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../unitig_evidence/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Unitig evidence encoding
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../evidence_elimination/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Evidence elimination (discussion)
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../layer_tier/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
obikindex layer tier
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../persistent_compact_int_vec/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
PersistentCompactIntVec
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../persistent_bit_vec/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
PersistentBitVec
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../merge/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Merge command
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../merge_parallelism/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Merge parallelism & memory
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../merge_mmap_audit/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Merge mmap audit (2026-11)
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../merge_scaling/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Merge scaling (open)
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../filtering/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Kmer filtering
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../select/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Select command
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../obitaxonomy/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
obitaxonomy crate
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../benchmark_query_testing/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Benchmark: query-path testing
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../partition_layer_cache/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Partition and layer caching (discussion)
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item md-nav__item--nested">
|
|
|
|
|
|
|
|
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" >
|
|
|
|
|
|
<label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Architecture
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span class="md-nav__icon md-icon"></span>
|
|
</label>
|
|
|
|
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="false">
|
|
<label class="md-nav__title" for="__nav_5">
|
|
<span class="md-nav__icon md-icon"></span>
|
|
|
|
|
|
Architecture
|
|
|
|
|
|
</label>
|
|
<ul class="md-nav__list" data-md-scrollfix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../architecture/sequences/invariant/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Sequences
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../architecture/index_architecture/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Kmer index
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../architecture/siblings/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Sibling annex
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../architecture/hot_resume_memoization/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
Hot resume and memoization
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../architecture/numa_worker_pools/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
NUMA-aware worker pools
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="md-nav__item">
|
|
<a href="../../architecture/numa_partition_runner/" class="md-nav__link">
|
|
|
|
|
|
|
|
<span class="md-ellipsis">
|
|
|
|
|
|
NUMA-aware partition runner
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</a>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
|
<div class="md-sidebar__scrollwrap">
|
|
<div class="md-sidebar__inner">
|
|
|
|
|
|
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<label class="md-nav__title" for="__toc">
|
|
<span class="md-nav__icon md-icon"></span>
|
|
Table of contents
|
|
</label>
|
|
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#1-what-ptr_hash-212-actually-offers-read" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
1. What ptr_hash 2.1.2 actually offers [read]
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#2-existing-batch-apis-that-are-not-batched-read" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
2. Existing "batch" APIs that are not batched [read]
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#3-cost-chain-of-a-membership-query-mphflayerfind-read" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
3. Cost chain of a membership query (MphfLayer::find) [read]
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#4-call-site-inventory" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
4. Call-site inventory
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#5-interactions" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
5. Interactions
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#6-benchmark" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
6. Benchmark
|
|
|
|
</span>
|
|
</a>
|
|
|
|
<nav class="md-nav" aria-label="6. Benchmark">
|
|
<ul class="md-nav__list">
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#throwaway-prod-scale-benchmark-not-written" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
Throwaway prod-scale benchmark (not written)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#7-not-verified" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
7. Not verified
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#8-first-improvement-and-measurements-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
8. First improvement and measurements (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#9-benchmark-procedure" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
9. Benchmark procedure
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#10-second-step-construction-pass-2-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
10. Second step — construction pass 2 (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#11-why-the-two-changes-gain-so-little-profiling-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
11. Why the two changes gain so little (profiling, 2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#12-calibration-a-single-skim-at-fewer-partitions-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
12. Calibration: a single skim at fewer partitions (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#13-query-on-a-real-scale-index-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
13. Query on a real-scale index (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#14-index-open-memory-idx-offsets-and-dict_values-mapped-not-copied-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
14. Index-open memory: .idx offsets and dict_values mapped, not copied (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#15-unbuffered-reads-indexmeta-and-superkmer-files-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
15. Unbuffered reads: index.meta and superkmer files (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#16-profile-of-index-on-e-coli-reads-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
16. Profile of index on E. coli reads (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#17-profile-of-index-on-a-skim-vaccinium-vitis-idaea-21-gb-partitions-16-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
17. Profile of index on a skim: Vaccinium vitis-idaea, 2.1 GB, --partitions 16 (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#18-de-bruijn-graph-hasher-walk-and-an-orientation-bug-that-fragmented-unitigs-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
18. De Bruijn graph: hasher, walk, and an orientation bug that fragmented unitigs (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#19-rank-field-unitig-chunks-capped-at-128-k-mers-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
19. Rank field: unitig chunks capped at 128 k-mers (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#20-summary-of-what-was-gained-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
20. Summary of what was gained (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
<nav class="md-nav" aria-label="20. Summary of what was gained (2026-10-15)">
|
|
<ul class="md-nav__list">
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#speed" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
Speed
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#memory-peak-rss-footprint" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
Memory (peak RSS / footprint)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#index-size-newly-built-indexes-existing-ones-are-unchanged" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
Index size (newly built indexes; existing ones are unchanged)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#correctness-fixes-found-on-the-way" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
Correctness fixes found on the way
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#what-is-not-established" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
What is not established
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
</li>
|
|
|
|
<li class="md-nav__item">
|
|
<a href="#21-dead-code-removed-2026-10-15" class="md-nav__link">
|
|
<span class="md-ellipsis">
|
|
|
|
21. Dead code removed (2026-10-15)
|
|
|
|
</span>
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="md-content" data-md-component="content">
|
|
|
|
<article class="md-content__inner md-typeset">
|
|
|
|
|
|
|
|
|
|
|
|
<h1 id="mphf-batch-queries-site-inventory-and-expected-gains">MPHF batch queries — site inventory and expected gains</h1>
|
|
<p>Investigation of 2026-10-14 (<code>ptr_hash</code> 2.1.2, <code>epserde</code> 0.13). Question: where would batched MPHF queries (software prefetch of the random accesses) save time? Status of each claim is marked <strong>[read]</strong> (verified in source), <strong>[computed]</strong> (derived from stated sizes) or <strong>[estimate]</strong> (reasoning, not measured). Measurements, once made, are in the last section.</p>
|
|
<h2 id="1-what-ptr_hash-212-actually-offers-read">1. What <code>ptr_hash</code> 2.1.2 actually offers [read]</h2>
|
|
<p><code>Mphf = PtrHash<u64, CubicEps, F = CachelineEfVec, Xxh3Int, V = Vec<u8>, SINGLE_PART = false, REMAP = true></code>.</p>
|
|
<ul>
|
|
<li><strong><code>V</code> is the pilot array</strong> (one byte per bucket), <strong><code>F</code> is only the remap storage</strong>. A layer's <code>mphf.bin</code> (~2.4 bits/key <strong>[computed]</strong>: 40 MB for ~130 M keys) is therefore almost entirely a byte array indexed by bucket. The batch APIs prefetch <code>pilots[bucket]</code> — the right line. The remap (read only when <code>slot >= n</code>, a small fraction of keys) is <strong>not</strong> prefetched.</li>
|
|
<li><code>index_batch<K>(xs: [Q; K]) -> [usize; K]</code> — stable, not feature-gated; hash K keys, prefetch K pilots, query. Remainder (<code>len % K</code>) is the caller's job.</li>
|
|
<li><code>index_stream<B>(keys: IntoIterator) -> impl Iterator</code> — ring buffer of B keys; handles head and tail itself; accepts any iterator. <strong>Its <code>next()</code> is <code>unimplemented!</code></strong>: only fold-based consumption works (<code>for_each</code>, <code>fold</code>, <code>sum</code>). <code>collect()</code>, <code>zip</code>, <code>for x in it</code> panic. Consume with <code>for_each</code> into a pre-sized <code>Vec</code>.</li>
|
|
<li><code>index_batch_exact</code> needs the nightly <code>unstable</code> feature; <code>index_batch_exact2</code> is <code>#[doc(hidden)]</code>. Neither is usable.</li>
|
|
<li>Prefetch is <code>prefetch-index 0.2.1</code>: <code>_mm_prefetch(T0)</code> on x86_64, asm on aarch64, <strong>no-op elsewhere</strong>.</li>
|
|
<li><strong><code>SINGLE_PART</code></strong>: neither <code>index_stream</code> nor <code>index_batch</code> branches on it — both always run the multi-part <code>bucket()</code>/<code>slot()</code>. Only <code>index()</code> has the faster single-part path. So with batched queries the <code>SINGLE_PART = true</code> advantage disappears, and <code>false</code> (our choice) costs nothing while keeping parallel construction (<code>true</code> also panics with sharding).</li>
|
|
<li>Old <code>ptr_hash</code> 1.1.0 has the same family with an extra <code>MINIMAL</code> const: <code>index_stream<B, MINIMAL, Q></code>, <code>index_batch<K, MINIMAL, Q></code>. No new dependency needed there.</li>
|
|
</ul>
|
|
<div class="highlight"><pre><span></span><code><span class="c1">// consuming index_stream: fold-based only</span>
|
|
<span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">out</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">Vec</span><span class="p">::</span><span class="n">with_capacity</span><span class="p">(</span><span class="n">kmers</span><span class="p">.</span><span class="n">len</span><span class="p">());</span>
|
|
<span class="n">mphf</span><span class="p">.</span><span class="n">index_stream</span><span class="p">::</span><span class="o"><</span><span class="mi">32</span><span class="p">,</span><span class="w"> </span><span class="n">_</span><span class="o">></span><span class="p">(</span><span class="n">kmers</span><span class="p">.</span><span class="n">iter</span><span class="p">().</span><span class="n">map</span><span class="p">(</span><span class="o">|</span><span class="n">k</span><span class="o">|</span><span class="w"> </span><span class="n">k</span><span class="p">.</span><span class="n">raw</span><span class="p">()))</span>
|
|
<span class="w"> </span><span class="p">.</span><span class="n">for_each</span><span class="p">(</span><span class="o">|</span><span class="n">slot</span><span class="o">|</span><span class="w"> </span><span class="n">out</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="n">slot</span><span class="p">));</span>
|
|
</code></pre></div>
|
|
<h2 id="2-existing-batch-apis-that-are-not-batched-read">2. Existing "batch" APIs that are not batched [read]</h2>
|
|
<p><code>MphfLayer::hash_batch</code> and <code>MphfOnly::index_batch</code> loop <code>.index()</code> one kmer at a time. Consumers: <code>obikfilter/partition_iter.rs</code> (<code>iter_layer_kmers</code>), <code>obikmerge/partition_merge.rs</code> (pass 2: <code>hash_batch</code>, <code>index_batch</code>), <code>obikphylo/siblings/algorithms/family_scan.rs</code> (two sites).</p>
|
|
<h2 id="3-cost-chain-of-a-membership-query-mphflayerfind-read">3. Cost chain of a membership query (<code>MphfLayer::find</code>) [read]</h2>
|
|
<ol>
|
|
<li><code>pilots[bucket]</code> — the only access <code>ptr_hash</code> prefetches.</li>
|
|
<li>Exact/Hybrid-exact: <code>evidence.decode(slot)</code> — 4 B/slot, ~520 MB per 130 M-slot layer <strong>[computed]</strong>, random mmap read.</li>
|
|
<li><code>verify_canonical_kmer</code> → <code>block_offsets[...]</code> (O(1) with the default <code>--block-size 1</code>; a forward scan of up to <code>2^block_bits</code> records otherwise).</li>
|
|
<li><code>extract_kmer_raw</code> — random read in the <code>unitigs.bin</code> mmap.</li>
|
|
</ol>
|
|
<p>Approx/Hybrid-fast: pilots then <code>fingerprint.get(slot)</code> — one extra random access.
|
|
Each stage is independent across kmers, so a staged batch (slots → prefetch evidence → decode, prefetch offsets/unitigs → verify) can overlap all of them. <code>ptr_hash</code> only helps with stage 1; stages 2–4 need prefetch support in <code>obikindex</code>/<code>obiskio</code> (not existing). Prefetch on an unmapped (cold, not paged-in) mmap page is dropped by the CPU, so none of this helps on a cold index.</p>
|
|
<p>Layer sizes: <code>layer_0</code> MPHF 2–3 MB (cache-resident), <code>layer_1</code> ~40 MB (beyond one CCD's L3 on EPYC-class machines — <strong>hypothesis</strong>, prod CPU not verified, and contended by 192 threads). Gains are expected mainly on <code>layer_1</code>. For branch-free independent loops (<code>hash_batch</code>) out-of-order execution already overlaps several misses, so the explicit prefetch gains less <strong>[estimate]</strong> than for branchy loops (<code>find</code> with early <code>break</code>).</p>
|
|
<h2 id="4-call-site-inventory">4. Call-site inventory</h2>
|
|
<p>(a) already batched; (b) batch buildable; (c) hard/pointless.</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Site</th>
|
|
<th>What</th>
|
|
<th>Class</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><code>mphf_layer.rs</code> <code>hash_batch</code>, <code>MphfOnly::index_batch</code></td>
|
|
<td>loop of <code>.index()</code></td>
|
|
<td>(a)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>obikfilter/partition_iter.rs:106</code></td>
|
|
<td><code>hash_batch</code>, 32768 kmers</td>
|
|
<td>(a)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>obikmerge/partition_merge.rs:489, 521</code></td>
|
|
<td><code>hash_batch</code>, <code>index_batch</code>, 4096</td>
|
|
<td>(a)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>obikphylo/.../family_scan.rs:285, 397</code></td>
|
|
<td><code>hash_batch</code></td>
|
|
<td>(a)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>obikquery/query_layer.rs</code> stage 1</td>
|
|
<td><code>find_in_layer</code> per kmer, layer by layer, <code>break</code> on hit</td>
|
|
<td>(b)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>partition_merge.rs</code> <code>find_batch_grouped</code></td>
|
|
<td><code>find_slot</code> per kmer over dst layers</td>
|
|
<td>(b)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>partition_merge.rs</code> (<code>build_graph</code> filter)</td>
|
|
<td><code>all(find_slot.is_none())</code>, every layer, per kmer; <code>build_graph</code> takes <code>Fn(CanonicalKmer)->bool</code></td>
|
|
<td>(b), API change</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>family_scan.rs</code> slow path; <code>annex.rs</code></td>
|
|
<td><code>find_slot</code> / <code>find_in_partition</code> per variant</td>
|
|
<td>(b)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>mphf_layer.rs</code> <code>build</code>, <code>build_exact_evidence</code>, <code>build_approx_evidence</code></td>
|
|
<td><code>mphf.index</code> then random writes (evidence, fingerprint, <code>seen</code>)</td>
|
|
<td>(b), chunked</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>obikindexer/counter/count.rs:47</code></td>
|
|
<td><code>mphf.index</code> then <code>counts.get/set</code></td>
|
|
<td>(b), hard (needs (kmer, count) pairs)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>obikindexer/extensions/private_builder.rs:177</code></td>
|
|
<td>abundance filter</td>
|
|
<td>(b), conditional</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>private_builder.rs:196</code>, <code>verify.rs</code>, <code>IndexCache::find_in_*</code></td>
|
|
<td>per-kmer by nature / sampled</td>
|
|
<td>(c)</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>Dead or suspect code found along the way (candidates for removal, not removed):</p>
|
|
<ul>
|
|
<li><code>MphfLayer::find_strict</code> — no caller.</li>
|
|
<li>the single-kmer <code>hash</code> chain (<code>MphfLayer::hash</code> → <code>TypedLayer::hash</code> → <code>KmerLayer::hash</code> → <code>IndexCache::hash</code>) — no caller outside the chain.</li>
|
|
<li><code>IndexCache::find</code> — no caller.</li>
|
|
<li><code>obikmerge/src/merge_layer/</code> — not declared in <code>lib.rs</code> (<code>mod merge; mod partition_merge;</code> only); still imports the <code>LayeredMap</code> removed in 2026-08. To be confirmed by the compiler.</li>
|
|
</ul>
|
|
<h2 id="5-interactions">5. Interactions</h2>
|
|
<ul>
|
|
<li><strong>Verification chain</strong>: the right shape is one <code>find_batch(&[CanonicalKmer], &mut Vec<Option<usize>>)</code> on <code>MphfLayer</code>, staged as in §3, so every consumer benefits (rule: enrich the shared API, no local loops).</li>
|
|
<li><strong>Memory</strong>: callers already hold bounded batches (4096 / 32768). A buffer-reusing variant avoids one <code>Vec<usize></code> per call. <code>index_stream</code> itself only allocates a B-element ring on the stack.</li>
|
|
<li><strong>Parallelism</strong>: no new parallelism. Batches already come out of <code>obipipeline</code> stages; the change lives in the transform body. Construction pass 2 is sequential inside a partition: chunk the streamed iterator (1–4 k kmers), never collect the layer. In <code>query_partition_with</code> the unique-kmer <code>HashMap</code> is already materialised; iterate it chunk-wise.</li>
|
|
</ul>
|
|
<h2 id="6-benchmark">6. Benchmark</h2>
|
|
<p><code>benchmark/bench_mphf.sh LABEL</code> times, on the 20-genome benchmark data, <code>index</code> (2 genomes), <code>merge</code> (20 presence indexes), <code>query</code> (presence/count × 2 genomes), <code>filter</code>, <code>convert</code> (approx/exact round trip) and <code>phylo</code> (<code>--sibling-annex</code>, <code>snp-jc</code>), <code>REPS</code> times each, and records order-independent output digests that must not change across labels. See the results section below.</p>
|
|
<p><strong>Limit of this data set</strong>: 20 small genomes → per-partition <code>layer_1</code> MPHFs of ~100 KB, fully cache-resident on the dev machine (Apple M3 Max, aarch64). This benchmark can detect regressions and the effect on instruction-level overlap; it <strong>cannot</strong> measure the DRAM-latency gain that motivates prefetch at 40 MB/layer. A faithful test needs a prod-scale layer (see the throwaway benchmark below).</p>
|
|
<h3 id="throwaway-prod-scale-benchmark-not-written">Throwaway prod-scale benchmark (not written)</h3>
|
|
<p>Open one real partition's <code>layer_1</code> (~130 M keys) and <code>layer_0</code> (~8 M) with <code>MphfOnly</code>/<code>MphfLayer</code>; key sets: present (sample of <code>iter_kmers</code>, random order and sequential order) and absent (random, checked absent); measure kmers/s for <code>index</code>, <code>index_stream::<B></code> (B ∈ 8…128), <code>index_batch::<K></code> (K ∈ 8…64), and the full <code>find</code> vs staged <code>find_batch</code>; at 1, 8, 32, 192 threads; pinned to one NUMA node, then spread; warm and cold page cache stated; 5 repetitions, min/median; sizes of <code>mphf.bin</code>, <code>evidence.bin</code>, <code>unitigs.bin(.idx)</code> reported; first check <code>index_stream</code> slots == <code>index</code> slots. The ~8–12 ns/key figure of the PtrHash paper (quoted in <code>mphf.md</code>) is a paper claim, not tied to our sizes or machines.</p>
|
|
<h2 id="7-not-verified">7. Not verified</h2>
|
|
<p>No measurement at prod scale; prod CPU architecture and cache sizes; evidence mode and <code>--block-size</code> used in prod; share of total index/merge/query time spent in these loops; <code>count.rs</code> f0 per partition at prod scale; whether <code>merge_layer/</code> is dead (only the head of <code>lib.rs</code> read).</p>
|
|
<h2 id="8-first-improvement-and-measurements-2026-10-15">8. First improvement and measurements (2026-10-15)</h2>
|
|
<p><strong>Implemented</strong> (query stage 1, the top-ranked site; the same change adds the plumbing the other sites will reuse):</p>
|
|
<ul>
|
|
<li><code>MphfLayer</code> now holds a <code>MphfOnly</code> instead of its own <code>MemCase<Mphf></code> (one mmap-open path, one place for the stream call).</li>
|
|
<li><code>MphfOnly::for_each_slot(kmers, f)</code> wraps <code>index_stream::<32></code>; <code>index_batch</code>/<code>hash_batch</code> now really use it (they previously looped <code>.index()</code>). Callback-shaped because <code>index_stream</code>'s <code>next()</code> is <code>unimplemented!</code>.</li>
|
|
<li><code>MphfLayer::find_batch</code> / <code>TypedLayer::find_slot_batch</code> / <code>KmerLayer::find_slot_batch</code>; the mode-dependent half of <code>find</code> is factored into <code>MphfLayer::confirm</code>, shared by both.</li>
|
|
<li><code>query_partition_with</code> stage 1 is layer-major over chunks of 4096 unique kmers: each layer receives the still-unresolved kmers as one batch (first hit wins, <code>n_mphf_calls</code> unchanged).</li>
|
|
<li>Not done: staged prefetch of evidence/offsets/unitigs (needs a prefetch primitive; <code>prefetch-index</code> is already in the tree via <code>ptr_hash</code>, but adding it to <code>obikindex</code> is a dependency decision), and the other (b) sites.</li>
|
|
</ul>
|
|
<p><strong>Measurements</strong> (<code>benchmark/bench_mphf.sh</code>, <code>benchmark/summarize_bench.py</code>; Apple M3 Max, aarch64; 20 genomes at 15x). Interleaved A/B, 8 runs each, E. coli reads queried against the 20-genome presence index:</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>wall (s)</th>
|
|
<th>user CPU (s)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>before</td>
|
|
<td>5.94–6.02 (median 5.96)</td>
|
|
<td>10.95–11.07</td>
|
|
</tr>
|
|
<tr>
|
|
<td>after</td>
|
|
<td>5.63–6.00 (median 5.67)</td>
|
|
<td>10.33–10.66</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>About −5 % wall and −5.5 % CPU, ranges non-overlapping <strong>[measured]</strong>. All output digests (query ×4, merge, filter, convert round trip, phylo) are identical before and after.</p>
|
|
<p><strong>Reading the number.</strong> Small by construction: this data set's <code>layer_1</code> MPHFs are ~100 KB per partition, cache-resident, and query time is dominated by reading and k-merising the reads. The gain seen here is instruction-level overlap, not DRAM-latency hiding. The latter, the reason for the whole exercise, remains <strong>unmeasured</strong> and needs a prod-scale layer (§6).</p>
|
|
<p><strong>Noise caveat.</strong> With a load average of 16–22 from unrelated processes, single-run walls of <code>index</code>, <code>merge</code> and <code>filter</code> moved ±10–40 % between identical binaries; only interleaved repeated A/B runs were trustworthy. The <code>index</code>/<code>merge</code>/<code>filter</code>/<code>convert</code>/<code>phylo</code> rows of the first comparison are noise, not effects (<code>index</code> pass 2 was not changed at all; a later interleaved <code>filter</code> A/B was inconclusive, 13.0 s vs 13.8 s medians with a 10–20 s spread).</p>
|
|
<p><strong>Stale benchmark indexes.</strong> The indexes already under <code>benchmark/run/</code> (<code>specimen_index_*</code>, <code>global_index_*</code>, built 2026-08-28) carry <code>ptr_hash</code> 1.x MPHFs and fail with "Major version mismatch" on current binaries. <code>bench_mphf.sh</code> therefore builds its own copies under <code>run/bench_mphf/data/</code> on first use.</p>
|
|
<h2 id="9-benchmark-procedure">9. Benchmark procedure</h2>
|
|
<p>Prerequisites: the simulated reads (<code>benchmark/run/simulated_data/</code>) and query reads (<code>benchmark/run/query_data/</code>) produced by <code>gmake simulate simulate_query</code>; macOS BSD <code>time -l</code> and <code>md5 -q</code> (the script uses both), Python 3.</p>
|
|
<ol>
|
|
<li>Build the binary to measure and <strong>copy it</strong> under a name that identifies it (cargo overwrites <code>target/release/obiskim</code>): <code>cp src/target/release/obiskim benchmark/run/bench_mphf/obiskim_<label></code>.</li>
|
|
<li><code>BINARY=$PWD/run/bench_mphf/obiskim_<label> benchmark/bench_mphf.sh <label></code> (from <code>benchmark/</code>; <code>REPS=3</code> by default, <code>CPU_MAX=n</code> to restrict cores). The first call builds the shared data set in <code>run/bench_mphf/data/</code> with that binary (≈ 2 min); keep it for every label — the on-disk format must not differ between the binaries compared, otherwise delete <code>data/</code> and rebuild.</li>
|
|
<li>Output: <code>run/bench_mphf/<label>/results.csv</code> (wall and peak RSS per step and repetition, plus one row <code>step:stage</code> per Reporter stage) and <code>checksums.txt</code>.</li>
|
|
<li>Compare: <code>python3 benchmark/summarize_bench.py <ref_label> <new_label></code> (medians and ratio) and <code>diff run/bench_mphf/<ref>/checksums.txt run/bench_mphf/<new>/checksums.txt</code> — <strong>any difference is a bug</strong>, not a performance matter.</li>
|
|
<li>A ratio is only a candidate effect. Check the spread by running the <strong>same</strong> binary twice under two labels (the script's own noise floor was ±10–40 % per step on a loaded laptop), or confirm with interleaved A/B runs of the single command (alternate the two binaries, ≥ 8 runs, compare ranges of wall and user CPU from <code>/usr/bin/time -l</code>).</li>
|
|
<li>Rule of thumb for this data set: only <code>query</code> (≈ 5 s, stable to ±1 %) resolves effects of a few percent; <code>index</code>, <code>merge</code>, <code>filter</code>, <code>phylo</code> need interleaved runs or a quiet machine.</li>
|
|
</ol>
|
|
<p>Step → code exercised:</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Step</th>
|
|
<th>Code on the MPHF path</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><code>index_*</code> (<code>:index</code> stage)</td>
|
|
<td><code>MphfLayer::build</code> pass 2</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>merge_20_presence</code></td>
|
|
<td><code>find_batch_grouped</code>, <code>build_graph</code> filter, <code>hash_batch</code>, <code>index_batch</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>query_*</code></td>
|
|
<td><code>query_partition_with</code> stage 1</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>filter_species</code></td>
|
|
<td><code>iter_layer_kmers</code> → <code>hash_batch</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>convert_to_*</code></td>
|
|
<td><code>build_exact_evidence</code>, <code>build_approx_evidence</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>phylo_sibling_annex</code></td>
|
|
<td><code>annex.rs</code> <code>find_in_partition</code> per variant</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>phylo_snp_distance</code></td>
|
|
<td><code>family_scan.rs</code> <code>hash_batch</code>, <code>find_slot</code></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h2 id="10-second-step-construction-pass-2-2026-10-15">10. Second step — construction pass 2 (2026-10-15)</h2>
|
|
<p><strong>Implemented</strong>: <code>layer/slotted.rs</code>, <code>SlottedKmers</code>, an iterator adapter yielding <code>(slot, kmer, chunk_id, rank)</code> for the wrapped <code>(kmer, chunk_id, rank)</code> stream, computing slots 4096 kmers at a time through <code>index_stream::<32></code> (bounded memory, never the whole layer). The five loops of <code>MphfLayer::build</code> (Exact, Approx, Hybrid), <code>build_exact_evidence</code> and <code>build_approx_evidence</code> now iterate it instead of calling <code>mphf.index</code> per kmer. Output digests unchanged.</p>
|
|
<p><strong>Measured</strong> (interleaved A/B against the first-step binary, 8 runs each, wall / user CPU):</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Command</th>
|
|
<th>before</th>
|
|
<th>after</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><code>convert --exact-evidence</code> (20-genome index)</td>
|
|
<td>0.56–0.68 s / 2.22–2.67 s</td>
|
|
<td>0.59–0.74 s / 2.25–2.52 s</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>index</code> E. coli reads</td>
|
|
<td>2.45–2.63 s / 13.1–14.3 s</td>
|
|
<td>2.48–2.75 s / 13.2–14.0 s</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p><strong>No measurable effect</strong> on this data set (differences within the run-to-run spread; if anything <code>convert</code> is ≈ 4 % slower in wall time). Expected here: the MPHF is cache-resident and <code>index</code>/<code>convert</code> time is dominated by other stages (scatter, dereplication, counting, unitig decoding, the random evidence/<code>seen</code> writes themselves). The construction gain, if any, only exists where the pilot array does not fit in cache, and the random <em>writes</em> to <code>evidence.bin</code>/<code>seen</code>/<code>fingerprint.bin</code> (not prefetched by <code>ptr_hash</code>) probably dominate there too. Whether to keep this change is therefore a decision to take after the prod-scale benchmark (§6), not on this data.</p>
|
|
<h2 id="11-why-the-two-changes-gain-so-little-profiling-2026-10-15">11. Why the two changes gain so little (profiling, 2026-10-15)</h2>
|
|
<p>Measured with macOS <code>sample</code> (1 ms stack sampling) on the 20-genome data, one run each — coarse, but the orders of magnitude are unambiguous.</p>
|
|
<p><strong>Query.</strong> In a 2 s window on the <code>query</code> stage (16 threads, ≈ 3 100 active samples against ≈ 55 000 samples of idle waiting):</p>
|
|
<ul>
|
|
<li><code>query_partition_with</code> ≈ 260 samples (8 % of active CPU), of which <code>find_batch</code> 217, of which <strong><code>verify_canonical_kmer</code> 185</strong> and everything else in <code>find_batch</code> (the <code>ptr_hash</code> stream and <code>confirm</code>) <strong>32</strong>.</li>
|
|
<li><code>verify_canonical_kmer</code> is the single largest active function of the window (399 top-of-stack samples). The MPHF lookup is ≈ 1 % of active CPU: even a free MPHF could not give more.</li>
|
|
<li>Reason: per-partition pilot arrays are ~100 KB (≈ 25 MB over 256 partitions) and stay cached; the evidence/<code>unitigs.bin</code>/offset accesses of the verification (§3, stages 2–4) are the ones that miss. This data set already has the problem on the verification side, not on the MPHF side.</li>
|
|
<li>The threads are mostly idle: the stage is bounded by reading/parsing/k-merising the reads (<code>rolling_stat</code>, entropy tracker, string formatting) and by sequential parts, not by lookups.</li>
|
|
</ul>
|
|
<p><strong>What produced the −5 %.</strong> Interleaved A/B, 8 runs each, median wall: original 6.4 s; chunked layer-major restructuring with plain per-kmer <code>index</code> (stream disabled) 6.0 s; restructuring + <code>index_stream</code> 5.85 s. <strong>Most of the gain comes from the restructuring, not from the prefetch</strong> (the prefetch adds ≈ 2 %, at the limit of the noise). Hypothesis, not isolated: the old loop called <code>IndexCache::get_layer</code> — an <code>Arc<KmerLayer></code> clone, i.e. an atomic increment/decrement on a refcount shared by all threads — once per kmer per layer; the batched loop does it once per layer per chunk of 4096.</p>
|
|
<p><strong>Index (pass 2).</strong> In a 1 s window late in the <code>index</code> stage, <code>SlottedKmers</code> appears with ≈ 7 samples out of 304 per thread (≈ 2 %), against ≈ 200 for the de Bruijn graph work (<code>obidebruinj</code>) and ≈ 35 for <code>ptr_hash::build</code> (pass 1, MPHF <em>construction</em>). Pass 2 is a few percent of <code>index</code> and <code>convert</code> here: nothing to win even if its lookups were free. <code>convert</code> is <code>build_*_evidence</code> on 2 MB-scale layers, same conclusion.</p>
|
|
<p><strong>Consequences for priorities.</strong></p>
|
|
<ol>
|
|
<li>On this data the next lever is the verification (<code>verify_canonical_kmer</code>, evidence decode), not the MPHF — consistent with §3, now observed.</li>
|
|
<li>Hot <code>Arc</code> clones in per-kmer paths (<code>get_layer</code>, <code>IndexCache::find_in_layer</code>, <code>find_slot</code> loops in merge and phylo) are worth auditing independently of MPHF batching.</li>
|
|
<li>The DRAM-latency gain of prefetch is untested until a prod-scale layer is available (§6).</li>
|
|
</ol>
|
|
<h2 id="12-calibration-a-single-skim-at-fewer-partitions-2026-10-15">12. Calibration: a single skim at fewer partitions (2026-10-15)</h2>
|
|
<p><code>Vaccinium myrtillus</code> skim (2 × ~440 MB fastq.gz, <code>theta 0</code>), indexed with the current binary, to find the partition count that gives prod-sized MPHFs (<code>--partitions</code> is a power of two; MPHF size ≈ 2.4 bits/key <strong>[measured]</strong>):</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th><code>-p</code></th>
|
|
<th>keys / partition</th>
|
|
<th><code>mphf.bin</code> / partition</th>
|
|
<th>index wall</th>
|
|
<th>peak RSS</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>256 (default)</td>
|
|
<td>≈ 1.4 M <strong>[computed from p=16]</strong></td>
|
|
<td>≈ 0.4 MB <strong>[computed]</strong></td>
|
|
<td>–</td>
|
|
<td>–</td>
|
|
</tr>
|
|
<tr>
|
|
<td>16</td>
|
|
<td>22.1 M</td>
|
|
<td>6.65 MB</td>
|
|
<td>120 s</td>
|
|
<td>12.3 GB</td>
|
|
</tr>
|
|
<tr>
|
|
<td>4</td>
|
|
<td>86–90 M</td>
|
|
<td>25.9–27.0 MB</td>
|
|
<td>171 s</td>
|
|
<td>19.5 GB</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>Total ≈ 354 M distinct kmers for one skim. <code>-p 4</code> is already in the 30–45 MB range of the prod <code>layer_1</code> MPHFs; <code>-p 2</code> would give ≈ 53 MB. Indexes kept in <code>benchmark/run/bench_mphf/skim_p16</code> and <code>skim_p4</code> (2.3 GB each). Note the index stage itself is dominated by graph and MPHF construction, as in §11.</p>
|
|
<h2 id="13-query-on-a-real-scale-index-2026-10-15">13. Query on a real-scale index (2026-10-15)</h2>
|
|
<p><strong>Index.</strong> Working index <code>phyloskims_sal_vac_sav</code> (91 genomes of Salix/Vaccinium, 256 partitions × 2 layers, exact evidence, 180 GB, ptr_hash 1.x MPHFs). Converted to ptr_hash 2 <strong>on an APFS clone</strong> (<code>cp -c</code>, 0.8 s, no space used until written; the original was left untouched — verified by mtime): 512 layers in 10 min (1311 % CPU), ≈ 57 GB of new data. Clone at <code>/Users/coissac/travail/obiskim/data/phyloalps/bench_mphf/phyloskims_sal_vac_sav_v2</code>; its sibling annex is in <code>stale_annexes_pre_ptrhash2/</code> and would need rebuilding to be used. Per partition: <code>layer_1</code> ≈ 31 M keys / 9.3 MB MPHF, <code>layer_0</code> ≈ 5.6 M keys / 1.7 MB — larger than the 20-genome set (100 KB) but 4× smaller than the production layers (~130 M keys, ~40 MB).</p>
|
|
<p><strong>Query</strong> (2 × 48 MB of <em>V. oxycoccos</em> reads, <code>--chunk-size 8</code>, AC power, 3 interleaved runs per binary, identical sorted output for all three):</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>binary</th>
|
|
<th>wall (s)</th>
|
|
<th>user CPU (s)</th>
|
|
<th><code>query</code> stage (s)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>original</td>
|
|
<td>28.2–30.5</td>
|
|
<td>70.9–74.4</td>
|
|
<td>14.6–17.1</td>
|
|
</tr>
|
|
<tr>
|
|
<td>+ batched query stage 1</td>
|
|
<td>26.9–28.0</td>
|
|
<td>48.1–48.6</td>
|
|
<td>13.6–14.4</td>
|
|
</tr>
|
|
<tr>
|
|
<td>+ <code>PartitionKmers</code> memory fix, build-side <code>SlottedKmers</code></td>
|
|
<td>26.4–26.7</td>
|
|
<td>41.9–42.5</td>
|
|
<td>12.9–13.3</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>The <code>query</code> stage is ≈ 50 % of wall time; the rest (≈ 13 s) is opening the index (next paragraph). Stage-only gain ≈ −6 % then −11 %; CPU time −33 % then −41 %. <strong>The CPU drop is much larger than the wall drop</strong> and is not explained by MPHF prefetch alone (§11: restructuring, probably the per-kmer <code>Arc</code> clones of <code>get_layer</code>, not isolated); the original binary was spending CPU in contention that wall time hid.</p>
|
|
<p><strong>Index-open cost (not related to the changes above).</strong> A query of a single 64-base sequence on this index takes <strong>15 s and a 27 GB peak footprint</strong>. <code>vmmap</code> during the open: 24.5 GB of <code>MALLOC_LARGE</code> in 1 481 regions (≈ 3 per layer, 7.3 GB already swapped out), i.e. heap allocations made by <code>IndexCache::new</code> for every layer of every partition whatever the query. Known contributors: <code>UnitigFileReader</code> reads each <code>.idx</code> into a <code>Vec</code> (≈ 30 MB for <code>layer_1</code>, ≈ 9 GB over 512 layers); the remaining ~15 GB are in the presence-matrix open path (not yet attributed). Opening only the partitions a query touches is not an option for a read set that spans all of them, but these structures could be mmapped instead of copied.</p>
|
|
<h2 id="14-index-open-memory-idx-offsets-and-dict_values-mapped-not-copied-2026-10-15">14. Index-open memory: <code>.idx</code> offsets and <code>dict_values</code> mapped, not copied (2026-10-15)</h2>
|
|
<p><strong>Cause</strong> (§13, now attributed): of the 27 GB opened by a one-sequence query on the 91-genome index, <strong>18.2 GB</strong> were <code>unitigs.bin.idx</code> read into a <code>Vec<u32></code> <strong>twice</strong> per exact-evidence layer (<code>MphfLayer::open</code> builds two <code>UnitigFileReader</code>s of the same file — one for the evidence check, one for <code>iter_kmers</code>/<code>find_strict</code>; both go through <code>open</code> → <code>open_direct_access</code> → <code>read_idx</code> → <code>fs::read</code> + copy) and <strong>7.7 GB</strong> were <code>dict_values.bin</code> read with <code>fs::read</code> in <code>PersistentSparseBitMatrix::open</code>. Computed from the real file sizes: 2 × 9.10 + 7.71 = 25.9 GB, against 27.4 GB measured. Everything else the matrix opens (<code>PersistentRankSelectBitVec</code>, <code>PersistentFixedIntVec</code>, <code>EliasFano</code>) was already mmapped.</p>
|
|
<p><strong>Change.</strong>
|
|
- <code>obiskio::unitig_index::reader</code>: <code>block_offsets: Vec<u32></code> → <code>BlockOffsets</code>, a view into the memory-mapped <code>.idx</code> (header parsed once, offsets read little-endian on access, no unsafe, no alignment requirement). Truncation is checked at open, so later accesses cannot run past the map. Both readers of a layer now share the same page-cache pages.
|
|
- <code>obicompactvec::bitmatrix::sparse</code>: <code>dict_values: Vec<u8></code> → <code>Option<Mmap></code> (<code>None</code> for an empty file, which cannot be mapped), read through <code>dict_bytes()</code>.</p>
|
|
<p><strong>Measured</strong> (same session, same inputs; sorted query outputs identical, md5 <code>e9e7c35b</code>):</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>open only (1-sequence query)</th>
|
|
<th>2×48 MB reads, <code>--chunk-size 8</code></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>before</td>
|
|
<td>10.6–15.7 s, <strong>27.4 GB</strong> footprint</td>
|
|
<td>27.7 s (51 s cold), 30.9 GB, <code>query</code> stage 13.8 s</td>
|
|
</tr>
|
|
<tr>
|
|
<td>after</td>
|
|
<td><strong>0.26–0.81 s, 0.04 GB</strong></td>
|
|
<td><strong>10.7 s, 3.6 GB</strong>, <code>query</code> stage 9.95 s</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>Tests: <code>cargo test --workspace</code> green; <code>scripts/smoke_test_index.sh</code> PASS; <code>bench_mphf.sh</code> (index, merge, query ×4, filter, convert round trip, phylo) completes with all output digests identical to the baseline run, i.e. no failure from files mapped while rewritten (the risk of mapping instead of copying: a reader holding a <code>.idx</code> map while the same path is truncated and rewritten would fault). The per-step ratios of that run vs the earlier baseline mix this change with the machine moving from battery to AC power and must not be read as its effect.</p>
|
|
<h2 id="15-unbuffered-reads-indexmeta-and-superkmer-files-2026-10-15">15. Unbuffered reads: <code>index.meta</code> and superkmer files (2026-10-15)</h2>
|
|
<p>Follow-up of §14 (search for the same family of problems: file content handled inefficiently at open). Static search over <code>src/</code> for <code>fs::read</code>, <code>read_to_end</code>, <code>load_full</code>, <code>from_reader</code>, bare <code>File</code> readers and mmap <code>to_vec</code>: every persistent structure of <code>obicompactvec</code>, <code>obikindex</code> and the <code>obikphylo</code> annexes is already mmapped; the two real findings were <em>unbuffered</em> readers.</p>
|
|
<p><strong>1. <code>IndexMeta::read_full</code> (<code>obikindex/src/index/meta.rs</code>)</strong> passed a bare <code>File</code> to <code>serde_json::from_reader</code>, which issues <strong>one <code>read</code> syscall per byte</strong>. <code>index.meta</code> of the 91-genome index is 20 KB and is read afresh by every <code>state()</code>/<code>genomes()</code> call (stateless design, §obikindex audit), so each call cost ≈ 0.35 s here (macOS). Profile of <code>obiskim dump --head 10</code> (<code>sample</code>): ≈ 20 000 samples in <code>read</code>, called from <code>Bytes<File>::next</code> ← <code>serde_json</code> ← <code>IndexMeta</code>. Fix: <code>fs::read</code> then <code>serde_json::from_slice</code>. <strong><code>dump --head 10</code>: 9.0–10.0 s (91–102 s of system CPU) → 0.16–0.84 s</strong>; the same change applies to <code>SKFileMeta::read</code> (<code>obiskio/src/meta.rs</code>, per-superkmer-file sidecars).</p>
|
|
<p><strong>2. <code>SKFileReader::open</code> (<code>obiskio/src/reader.rs</code>)</strong>: for an uncompressed file <code>niffler::get_reader</code> returns the sniffed bytes chained to the bare <code>File</code>, and <code>read_superkmer</code> reads each field with its own small <code>read_exact</code>. Fix: wrap the file in a 64 KiB <code>BufReader</code> before <code>niffler</code>. Effect on <code>index</code> (E. coli, 4 interleaved runs each): <code>count_kmer</code> 0.51–0.56 s → 0.42–0.50 s (≈ −12 %), total wall unchanged (≈ 1.95 s). Small, low risk, kept.</p>
|
|
<p>Tests: <code>cargo test --workspace</code> 549 passed / 0 failed; <code>scripts/smoke_test_index.sh</code> PASS; query output on the 91-genome index identical (md5 <code>e9e7c35b</code>).</p>
|
|
<p><strong>Probes of other commands on the 91-genome index (180 GB, 256 partitions)</strong>: <code>phylo --distance jaccard</code> peaks at 155–190 MB of footprint while running and finishes in < 30 s; <code>utils --stats</code> 130–150 MB. <code>filter</code> (and by the same check <code>select</code>, <code>merge</code>) refused the index — "source index is not fully built" — with the unmodified baseline binary too: this index's <code>index.meta</code> predates the <code>state</code> field, so they could not be probed.</p>
|
|
<p><strong>Observations not investigated</strong>: <code>index</code> on E. coli shows ≈ 9 s of <em>system</em> CPU in 2 s of wall time (both before and after these changes), consistent with the <code>swtch_pri</code> (yield) spinning seen in the <code>index</code> profile of §11 rather than with I/O; and wall times of the same query on the same binary varied 4.8 s ↔ 10.7 s ↔ 43 s depending on the state of the page cache, so only same-session comparisons are meaningful.</p>
|
|
<h2 id="16-profile-of-index-on-e-coli-reads-2026-10-15">16. Profile of <code>index</code> on E. coli reads (2026-10-15)</h2>
|
|
<p><code>sample</code> (1 ms stacks) of <code>obiskim index</code> on the E. coli K-12 simulated reads (2 × 15x, 16 threads, one run; the <code>index</code> stage lasted 2.4 s under the sampler vs ≈ 0.9 s normally, so proportions are approximate). Stage walls: scatter 0.40 s, dereplicate 0.14, count_kmer 0.60, index 2.36.</p>
|
|
<p><strong>Threads are mostly idle.</strong> Of ≈ 30 800 thread-samples: 24 900 blocked or yielding, 5 900 active. The ≈ 9 s of <em>system</em> CPU per run (§15) is <code>swtch_pri</code> (<code>sched_yield</code>) — 4 550 samples: ≈ 70 % rayon workers spinning for work (<code>WorkerThread</code> wait loop), ≈ 28 % <code>crossbeam</code> bounded-channel send/recv spinning, the rest in <code>obidebruinj</code> thread-locals. It is waiting, not I/O: no <code>read</code> samples remain. It costs no wall time on an otherwise idle machine, but burns CPU (visible in <code>user + sys</code> accounting and on a shared 192-core machine).</p>
|
|
<p><strong>Where the active CPU goes</strong> (share of the 5 900 active samples):</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>share</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>xxh3 hashing of <code>CanonicalKmer</code> for the de Bruijn graph's <code>HashMap</code> (callers: <code>count_neighbors</code> 791, <code>hash_one</code> 358, <code>walk</code> 285, <code>unitig_iter</code> 252, <code>push</code> 164, <code>unitig_nucleotides</code> 75, rehash 68; plus <code>xxh3_stateful_update</code> 300)</td>
|
|
<td>≈ 34 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>debruijn::count_neighbors</code> itself (inclusive of its hashing ≈ 2 300 samples: <code>compute_degrees_and_mark_starts</code>)</td>
|
|
<td>12.5 % own</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>ptr_hash::build</code> (MPHF construction)</td>
|
|
<td>4.8 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td>crossbeam channel send</td>
|
|
<td>4.8 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>open</code> / <code>close</code> / <code>write</code> (many small files over 256 partitions)</td>
|
|
<td>≈ 9 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td>debruijn <code>unitig_iter</code> / <code>walk</code> own time</td>
|
|
<td>8.3 %</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>So at this scale the cost of <code>index</code> is the <strong>de Bruijn graph's hash table</strong> (several lookups of neighbouring k-mers per k-mer, each hashed with xxh3 and probably missing the cache), not the MPHF passes this document started from (<code>SlottedKmers</code> ≈ 2 %, §11). Not measured: what fraction of those lookups miss the cache, and the same profile on a prod-size partition.</p>
|
|
<h2 id="17-profile-of-index-on-a-skim-vaccinium-vitis-idaea-21-gb-partitions-16-2026-10-15">17. Profile of <code>index</code> on a skim: <em>Vaccinium vitis-idaea</em>, 2.1 GB, <code>--partitions 16</code> (2026-10-15)</h2>
|
|
<p>One run, <code>sample</code> windows of 5 s every ~17 s over the whole run (the sampler slows the process; walls below include it): scatter 19.7 s, dereplicate 8.0 s, count_kmer 25.2 s, <strong>index 139.1 s</strong>; total 192 s real, 1830 s user, <strong>225 s system</strong> (12 % of user, against ≈ 90 % on E. coli, §16), peak footprint 17.8 GB.</p>
|
|
<p><strong>Index stage</strong> (samples taken fully inside it, 91 000 active vs 187 000 idle/yielding thread-samples):</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>share of active CPU</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>xxh3 hashing of kmers (de Bruijn <code>HashMap</code>)</td>
|
|
<td>32.7 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>debruijn::walk</code></td>
|
|
<td>12.4 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>debruijn::count_neighbors</code></td>
|
|
<td>10.7 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>GraphDeBruijn::push</code></td>
|
|
<td>6.9 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>crossbeam</code> channel</td>
|
|
<td>6.6 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>hashbrown</code> table operations</td>
|
|
<td>5.0 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>debruijn::unitig_iter</code></td>
|
|
<td>4.8 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td>memcpy/memset, malloc/free, file I/O, SipHash</td>
|
|
<td>≈ 7 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td>other</td>
|
|
<td>13.7 %</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<ul>
|
|
<li><strong>The de Bruijn graph is ≈ 72 % of the active CPU of <code>index</code>; the MPHF construction does not appear (< 1 %)</strong>, and <code>SlottedKmers</code>/evidence filling is negligible. The conclusion of §16 holds at 100× the E. coli scale.</li>
|
|
<li><strong>The stage is poorly parallel</strong>: on average ≈ 5 of 16 threads are active (33 % of thread-samples); <code>swtch_pri</code> (spin/yield) is 7 % of all thread-samples. With 16 partitions of unequal size the tail partitions run alone. The 12 % system CPU is the same spinning as §16, at a smaller relative weight.</li>
|
|
<li><strong>count_kmer</strong> (one window): sorting 40 %, file I/O 18 %, malloc/free 9 %, memcpy 6 %. <strong>scatter</strong> (one window, 32 % active): <code>RollingStat::push</code> 32 %, <code>EntropyTracker::push</code> 23 % + <code>normalized_entropy</code> 5 %, super-kmer stream 10 %, gzip decode ≈ 9 %.</li>
|
|
</ul>
|
|
<p>Not established: the cache-miss rate of the graph's table (stalls are attributed to whichever instruction waits, so "hashing 33 %" may include time waiting for the hasher's operands or surrounding loads — a counter-based profile is needed to separate compute from memory stalls), and whether a cheaper hash function for <code>u64</code> kmers or fewer lookups per kmer would change the picture.</p>
|
|
<h2 id="18-de-bruijn-graph-hasher-walk-and-an-orientation-bug-that-fragmented-unitigs-2026-10-15">18. De Bruijn graph: hasher, walk, and an orientation bug that fragmented unitigs (2026-10-15)</h2>
|
|
<p>Benchmark harness: <code>obikindexer/examples/graph_bench.rs</code> (<code>graph_bench <unitigs.bin> <k> [repeat]</code>; env <code>IDEAL=1</code> counts maximal unitigs independently of <code>GraphDeBruijn</code>, <code>SYNTH=n</code> uses synthetic reads, <code>DUMP</code>/<code>IDEALDUMP</code> print unitigs). Reference input: the 32.6 M kmers of one partition of the <em>V. vitis-idaea</em> index (<code>-p 16</code>, k = 31). Phase timings, 16 threads: push / <code>compute_degrees_and_mark_starts</code> / <code>for_each_unitig</code>.</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>push</th>
|
|
<th>degrees</th>
|
|
<th>unitigs</th>
|
|
<th>unitigs produced</th>
|
|
<th>nucleotides</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>original</td>
|
|
<td>4.1 s</td>
|
|
<td>2.0 s</td>
|
|
<td>3.9 s</td>
|
|
<td>6.56 M (varies ±900 per run)</td>
|
|
<td>229.4 M</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>u64</code> hasher (below)</td>
|
|
<td>1.0 s</td>
|
|
<td>0.7 s</td>
|
|
<td>3.1 s</td>
|
|
<td>6.56 M</td>
|
|
<td>229.4 M</td>
|
|
</tr>
|
|
<tr>
|
|
<td>+ orientation fix</td>
|
|
<td>1.0 s</td>
|
|
<td>0.8 s</td>
|
|
<td><strong>1.0 s</strong></td>
|
|
<td><strong>3.81 M</strong> (stable ±3)</td>
|
|
<td><strong>146.9 M</strong></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>Independent count of maximal unitigs on the same kmers (nodes − mutually-unique links): 3 809 887. After the fix the algorithm gives 3 809 945 (+0.002 %, cycles).</p>
|
|
<p><strong>1. Hasher</strong> (<code>debruijn/kmer_hash.rs</code>). The node table used xxh3's streaming <code>Hasher</code> (<code>Xxh3Builder</code>), for a key that is one <code>u64</code>: ≈ 35 % of the active CPU of <code>index</code> (§17). Replaced by a splitmix64 finaliser <code>BuildHasher</code> (one multiply–shift pair, no state). push 4.1 → 1.0 s, degrees 2.0 → 0.7 s. <code>xxhash-rust</code> is no longer used by <code>obidebruinj</code> (left in its <code>Cargo.toml</code>; removing it is a dependency decision).</p>
|
|
<p><strong>2. Walk</strong>: <code>WalkState</code> now carries the node's own <code>&AtomicU8</code>, so marking the next node visited does not look the kmer up a second time (−2 % on the unitig phase: not where the time was).</p>
|
|
<p><strong>3. Unitig fragmentation — a bug, not a tuning.</strong> Starts are detected only for the canonical orientation. A chain whose end node is stored reverse-complemented has no recognised start and falls into the sequential "cycles and tails" pass, where <code>find_chain_start</code> returned only the kmer, dropping the orientation, and <code>unitig_nucleotides</code> always restarted in the canonical orientation: from the wrong end it extends nowhere and emits a <strong>lone-kmer unitig</strong>, repeatedly, along the chain. The result depended on table iteration order (<code>degrees_linear_chain_extensions</code> passed with xxh3's order and failed with any other; counts varied run to run) and was never maximal: <strong>72 % more unitigs than maximal</strong> on the reference partition. A second slip in the reverse branch of <code>WalkState::walk</code> (the <code>can_extend_left</code>/<code>can_extend_right</code> test of the next node was swapped) cost another ~15 %. Fixes: <code>walk</code> condition corrected; <code>find_chain_start</code> returns <code>(kmer, direct)</code> with the orientation to walk forward; <code>unitig_nucleotides</code> and <code>UnitigNucIter</code> take that orientation (and read the first k nucleotides reverse-complemented when it is false); starts are now flagged in both orientations and the claim picks the right one (<code>start_direction</code>). Regression tests: <code>linear_chain_is_one_unitig_whatever_the_orientations</code> (fails on the original code, passes now) and <code>unitigs_partition_the_kmers_of_branching_reads</code> (every kmer in exactly one unitig).</p>
|
|
<p>Residual: on noisy synthetic reads (k = 11–31, 200–20 000 bases) the algorithm still gives up to 5 % more unitigs than the independent count, always a few short pieces next to chain ends; not explained, absent from real data (+0.002 %).</p>
|
|
<p><strong>End-to-end</strong> (current binary vs previous one, same inputs):</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>before</th>
|
|
<th>after</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><em>V. vitis-idaea</em> 2.1 GB, <code>--partitions 16</code>: total wall</td>
|
|
<td>163.8 s</td>
|
|
<td><strong>116.5 s</strong> (−29 %)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>… <code>index</code> stage</td>
|
|
<td>114.6 s</td>
|
|
<td><strong>59.2 s</strong> (−48 %)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>… user CPU</td>
|
|
<td>1 870 s</td>
|
|
<td>1 304 s</td>
|
|
</tr>
|
|
<tr>
|
|
<td>… <code>unitigs.bin</code> / <code>.idx</code></td>
|
|
<td>1.05 / 0.42 GB</td>
|
|
<td><strong>0.66 / 0.24 GB</strong> (−37 % / −43 %); index 3.5 → 2.9 GB</td>
|
|
</tr>
|
|
<tr>
|
|
<td>E. coli, <code>index</code> stage / wall / user CPU</td>
|
|
<td>0.91 s / 1.97 s / 10.2 s</td>
|
|
<td>0.59 s / 1.63 s / 7.3 s</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>Same k-mers: per-layer kmer counts identical (521 630 625 over the 16 layers), E. coli <code>dump</code> and <code>query</code> outputs identical (md5), <code>scripts/smoke_test_index.sh</code> PASS, <code>cargo test --workspace</code> 551 passed / 0 failed, and <code>bench_mphf.sh</code> digests (index, merge, query ×4, filter, convert round trip, phylo) identical to the baseline run. Existing indexes are unaffected (any partition of kmers into unitigs is valid; evidence records are per-index); only newly built layers get the shorter, fewer unitigs.</p>
|
|
<h2 id="19-rank-field-unitig-chunks-capped-at-128-k-mers-2026-10-15">19. Rank field: unitig chunks capped at 128 k-mers (2026-10-15)</h2>
|
|
<p><code>Evidence</code> packs <code>(chunk_id, rank)</code> into a <code>u32</code> with a 7-bit rank (<code>encode</code> masks <code>& 0x7F</code>), but <code>MAX_KMERS_PER_CHUNK</code> was 256 (the width of the unitig record's length byte), so a chunk of 129–256 k-mers had its ranks ≥ 128 silently truncated and those k-mers no longer verified. Observed on E. coli reads, same query: <strong><code>--partitions 256</code></strong> → max chunk 49–50 k-mers, results correct with the old and the new binary; <strong><code>--partitions 1</code></strong> → max chunk 256, query output wrong with both the old (md5 <code>bde0f886a0</code>) and the post-graph-fix (<code>8f1c94ef32</code>) binary versus the correct <code>f99e971087</code>. The orientation fix of §18 makes unitigs longer, hence makes this more likely at low partition counts.</p>
|
|
<p><strong>Change</strong> (<code>obikseq::MAX_KMERS_PER_CHUNK</code>: 256 → 128; chosen so, rather than failing at write time: a longer unitig is simply written as consecutive chunks, nothing is lost). The constant is shared with the super-kmer chunking of the scatter files (<code>SuperKmer::write_to_binary</code>): super-kmers above 128 k-mers (rare) are now split into 128-k-mer records — readers are unchanged and old files stay readable. Tests that hard-coded 255/256/257/259/260 were made relative to the constant; new test <code>chunk_ranks_fit_the_7_bit_evidence_field</code>.</p>
|
|
<p><strong>After</strong> (E. coli, same query): <code>--partitions</code> 256 / 16 / 4 / 1 → max chunk 50 / 70 / 118 / 128 k-mers, query md5 <code>f99e971087</code> in all four cases. <code>cargo test --workspace</code>: 551 passed, 0 failed.</p>
|
|
<p><strong>Existing indexes.</strong> An index built with 256 partitions has chunks far below the limit (91-genome index, first 4 partitions: max 42–56, none above 128) and is unaffected. The <code>--partitions 4</code> skim index used for the benchmarks above (built before the cap) holds 6 chunks over 128 k-mers in its 4 partitions (max 135): a handful of k-mers out of ≈ 354 M verify wrongly. <code>scripts/check_unitig_chunks.py "<index>/partitions/part_*/index/layer_*/unitigs.bin"</code> reports chunks over 128 (it reads every unitigs.bin sequentially; k is hard-coded to 31 at its top).</p>
|
|
<h2 id="20-summary-of-what-was-gained-2026-10-15">20. Summary of what was gained (2026-10-15)</h2>
|
|
<p>Apple M3 Max (aarch64, 16 cores, 128 GB), on AC power; absolute times are not those of the 192-core production machine, ratios measured in one session are what is reported. "Original" = the binary at the start of this work; "now" = current tree. Every output digest checked (query, dump, merge, filter, convert, phylo) is identical before and after, except where stated.</p>
|
|
<h3 id="speed">Speed</h3>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Operation</th>
|
|
<th>Original</th>
|
|
<th>Now</th>
|
|
<th>Where</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>Open an index (query of one 64-base sequence), 91 genomes, 180 GB</td>
|
|
<td>10.4–13.3 s</td>
|
|
<td><strong>0.18–0.19 s</strong></td>
|
|
<td>§14, same-session A/B</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Query, 2 × 48 MB reads on that index (<code>--chunk-size 8</code>)</td>
|
|
<td>30.7–32.0 s (61.8 s cold), 70–76 s CPU</td>
|
|
<td><strong>11.6–13.2 s</strong>, 36–39 s CPU (−62 % wall, −50 % CPU)</td>
|
|
<td>§14, same-session A/B</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>dump --head 10</code> on that index</td>
|
|
<td>9.0–10.0 s (91–102 s system CPU)</td>
|
|
<td><strong>0.16–0.84 s</strong></td>
|
|
<td>§15</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>index</code> of a 2.1 GB skim (<em>V. vitis-idaea</em>, <code>--partitions 16</code>)</td>
|
|
<td>163.8 s (stage <code>index</code> 114.6 s)</td>
|
|
<td><strong>116.5 s</strong> (stage <code>index</code> 59.2 s): −29 % wall, −48 % on the stage, −30 % CPU</td>
|
|
<td>§18</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>index</code> of E. coli reads</td>
|
|
<td>1.97 s (stage 0.91 s), 10.2 s CPU</td>
|
|
<td>1.63 s (stage 0.59 s), 7.3 s CPU</td>
|
|
<td>§18</td>
|
|
</tr>
|
|
<tr>
|
|
<td>De Bruijn graph, 32.6 M kmers (push / degrees / unitigs)</td>
|
|
<td>4.1 s / 2.0 s / 3.9 s</td>
|
|
<td>1.0 s / 0.8 s / 1.0 s (×3.5 overall)</td>
|
|
<td>§18</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>index</code> stage <code>count_kmer</code> (E. coli)</td>
|
|
<td>0.51–0.56 s</td>
|
|
<td>0.42–0.50 s</td>
|
|
<td>§15</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Query on a small input (2 × 48 MB reads), single-genome index</td>
|
|
<td>11.4 s (2 chunks = 2 busy cores)</td>
|
|
<td><strong>2.4 s</strong> (−79 %) — automatic chunk size now follows the input size (<code>architecture/query.md</code>); on the 91-genome index the size was already 4 MiB</td>
|
|
<td>§20 follow-up</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h3 id="memory-peak-rss-footprint">Memory (peak RSS / footprint)</h3>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Operation</th>
|
|
<th>Original</th>
|
|
<th>Now</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>Opening the 91-genome index (any command that builds an <code>IndexCache</code>)</td>
|
|
<td><strong>27.4 GB</strong></td>
|
|
<td><strong>0.04 GB</strong> (§14: <code>.idx</code> offsets and <code>dict_values.bin</code> mapped instead of copied; they were read twice and once)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Query, 2 × 48 MB reads on that index</td>
|
|
<td>32.2–32.5 GB</td>
|
|
<td><strong>3.5–3.6 GB</strong></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Full query, ≈ 1 GB gz of reads, 354 M-kmer index, default chunk size</td>
|
|
<td><strong>73.7–80.7 GB</strong></td>
|
|
<td><strong>28.2 GB</strong> (§12 of <code>architecture/query.md</code>: <code>PartitionKmers</code> instead of a <code>HashMap<kmer, Vec></code> per partition: 71 → ~20 bytes per unique kmer)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>index</code> of the 2.1 GB skim</td>
|
|
<td>19.7 GB</td>
|
|
<td>18.3 GB</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h3 id="index-size-newly-built-indexes-existing-ones-are-unchanged">Index size (newly built indexes; existing ones are unchanged)</h3>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>Original</th>
|
|
<th>Now</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><code>unitigs.bin</code> / <code>unitigs.bin.idx</code> (2.1 GB skim, 521.6 M kmers, 16 partitions)</td>
|
|
<td>1.05 / 0.42 GB</td>
|
|
<td><strong>0.66 / 0.24 GB</strong> (−37 % / −43 %: 3.81 M unitigs instead of 6.56 M — the orientation fix of §18)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Whole index of that skim</td>
|
|
<td>3.5 GB</td>
|
|
<td><strong>2.9 GB</strong> (−17 %)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>evidence.bin</code></td>
|
|
<td>4 bytes per kmer</td>
|
|
<td>unchanged (still ≈ 40 % of the 91-genome index, 2.1 GB of 3.5 GB for the skim): reducing it is a separate design question (§ answer on exact evidence: ≈ −22 to −31 % of it by dropping the rank field, far more with a minimizer-indexed layout; neither implemented)</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h3 id="correctness-fixes-found-on-the-way">Correctness fixes found on the way</h3>
|
|
<ul>
|
|
<li>Unitigs were not maximal (72 % too many) and depended on hash-table iteration order (§18).</li>
|
|
<li>Chunks of 129–256 k-mers had their ranks silently truncated in the 7-bit evidence field and failed verification, visible with few partitions (§19, <code>scripts/check_unitig_chunks.py</code> to audit an index).</li>
|
|
<li><code>index.meta</code> and super-kmer files were parsed byte by byte (§15).</li>
|
|
</ul>
|
|
<h3 id="what-is-not-established">What is <strong>not</strong> established</h3>
|
|
<ul>
|
|
<li>The DRAM-latency gain of MPHF prefetch itself, the original motivation (§1–§6): the measured MPHF share of the profiles is ≈ 1 % (§11), and the layers here are 4× to 1 000× smaller than production ones. The −5 % seen on the first query change came mostly from batching per layer (probably fewer shared <code>Arc</code> clones, §11), not from prefetch. A prod-scale benchmark (§6) remains to be run on the production machine.</li>
|
|
<li>Speed-ups on the 192-core / 1 TB production machine, on <code>merge</code>, <code>filter</code>, <code>select</code> and <code>phylo</code> at the 180-genome scale (the 91-genome index could only be used for <code>query</code>, <code>dump</code>, <code>phylo --distance jaccard</code>, <code>utils --stats</code>; <code>filter</code>/<code>select</code>/<code>merge</code> refused its pre-<code>state</code> <code>index.meta</code> until it was patched in the clone).</li>
|
|
<li>The size of the Primula index composition (§ calculated: ≈ half evidence from 35–40 G kmers × 4 bytes; not measured).</li>
|
|
</ul>
|
|
<h2 id="21-dead-code-removed-2026-10-15">21. Dead code removed (2026-10-15)</h2>
|
|
<p>The items listed as unused in §4 were removed after Serena's <code>safe_delete_symbol</code> and the compiler confirmed no reference: <code>MphfLayer::find_strict</code>; the single-kmer <code>hash</code> chain (<code>MphfLayer::hash</code>, <code>TypedLayer::hash</code>, <code>KmerLayer::hash</code>, <code>IndexCache::hash</code>); <code>IndexCache::find</code>; the uncompiled <code>obikmerge/src/merge_layer/</code> directory (689 lines; <code>lib.rs</code> only declares <code>merge</code> and <code>partition_merge</code>); and <code>xxhash-rust</code> from <code>obidebruinj/Cargo.toml</code> (it still serves <code>obikseq</code>, <code>obifastwrite</code> and <code>obiksession</code>).</p>
|
|
<p>Side effect: <code>find_strict</code> was the only reader of the <code>unitigs</code> handle that <code>Hybrid</code> layers opened, so that field (and the extra <code>.idx</code> map and mmap per Hybrid layer) was dropped too. <code>find</code> on a Hybrid layer was already a fingerprint check; the exact evidence stays on disk (it gives the slot count and is what <code>convert</code> works from) but no API consults it any more. Restoring an exact lookup for Hybrid layers means re-adding <code>find_strict</code> and that field.</p>
|
|
<p><code>ahash</code> was not referenced by any source file of <code>obidebruinj</code> either and was removed from its <code>Cargo.toml</code> too.</p>
|
|
<p>Checks after the removal: <code>cargo build --release</code> without warnings, <code>cargo test --workspace</code> 555 passed / 0 failed, <code>scripts/smoke_test_index.sh</code> PASS.</p>
|
|
<p>Scratch artifacts of this work were deleted: the intermediate binaries, the two skim indexes (<code>skim_p4</code>, <code>skim_p16</code>) and the shared data set <code>benchmark/run/bench_mphf/data</code> (rebuilt automatically, ≈ 2 min, by the next <code>bench_mphf.sh</code>). Kept in <code>benchmark/run/bench_mphf/</code>: the original binary <code>obiskim_baseline</code> (reference for A/B runs) and the per-label results and checksums (18 MB in all). The 91-genome index converted to the current MPHF format (<code>/Users/coissac/travail/obiskim/data/phyloalps/bench_mphf/phyloskims_sal_vac_sav_v2</code>, with its <code>index.meta</code> patched, original <code>index.meta.before_state_fix</code> beside it) was left in place.</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</article>
|
|
</div>
|
|
|
|
|
|
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
|
|
</div>
|
|
|
|
</main>
|
|
|
|
<footer class="md-footer">
|
|
|
|
<div class="md-footer-meta md-typeset">
|
|
<div class="md-footer-meta__inner md-grid">
|
|
<div class="md-copyright">
|
|
|
|
|
|
Made with
|
|
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
|
|
Material for MkDocs
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
</div>
|
|
<div class="md-dialog" data-md-component="dialog">
|
|
<div class="md-dialog__inner md-typeset"></div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": [], "search": "../../assets/javascripts/workers/search.2c215733.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
|
|
|
|
|
<script src="../../assets/javascripts/bundle.79ae519e.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js"></script>
|
|
|
|
|
|
</body>
|
|
</html> |