feat: optimize unitig index and document evidence elimination
Replace the dense per-chunk offset index with a sparse block-sampled structure (64 chunks per block), reducing the index file size by approximately 300× while preserving O(1) k-mer extraction. Introduce a design document for eliminating the `evidence.bin` file, which accounts for ~66% of the lookup layer, by transitioning to fingerprint-based approximate indexing and value-based MPHF lookups. Update MkDocs navigation to include the new documentation and add a file count tracker to the scatter step progress bar for improved observability.
This commit is contained in:
1 parent
9b700ff4a4
commit
4a5ab0b8c2
5 files changed
+488
-151
No files matched your search
@@ -1,4 +1,6 @@
|
||||
use std::path::PathBuf;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
@@ -42,15 +44,21 @@ pub fn scatter(
|
||||
// Throttle in the source thread — never in a worker — to prevent deadlock.
|
||||
let throttled = throttle_paths(path_source, max_open);
|
||||
|
||||
let file_count = Arc::new(AtomicU64::new(0));
|
||||
|
||||
let t = Stage::start("scatter");
|
||||
let pipe = obipipeline::make_pipe! {
|
||||
PipelineData : PathWithSlot => Vec<RoutableSuperKmer>,
|
||||
||? { move |pw: PathWithSlot| {
|
||||
let PathWithSlot { path, _guard } = pw;
|
||||
info!("indexing: {}", path.display());
|
||||
// _guard travels into GuardedIter; released when all chunks are read
|
||||
open_chunks(path).map(|iter| GuardedIter { inner: iter, _guard })
|
||||
}} : Path => RawChunk,
|
||||
||? {
|
||||
let file_count = Arc::clone(&file_count);
|
||||
move |pw: PathWithSlot| {
|
||||
let PathWithSlot { path, _guard } = pw;
|
||||
let n = file_count.fetch_add(1, Ordering::Relaxed) + 1;
|
||||
info!("indexing [{}]: {}", n, path.display());
|
||||
// _guard travels into GuardedIter; released when all chunks are read
|
||||
open_chunks(path).map(|iter| GuardedIter { inner: iter, _guard })
|
||||
}
|
||||
} : Path => RawChunk,
|
||||
|? { move |rope| obiread::normalize_sequence_chunk(rope, k) } : RawChunk => NormChunk,
|
||||
| { move |rope| obiskbuilder::build_superkmers(rope, k, level_max, theta) } : NormChunk => Batch,
|
||||
};
|
||||
@@ -84,7 +92,8 @@ pub fn scatter(
|
||||
} else {
|
||||
(format!("{:.0} Mbp", bp / 1e6), format!("{:.0} Mbp/s", ema_rate / 1e6))
|
||||
};
|
||||
pb.set_message(format!("{count_str} {rate_str}"));
|
||||
let n_files = file_count.load(Ordering::Relaxed);
|
||||
pb.set_message(format!("{count_str} {rate_str} {n_files} files"));
|
||||
}
|
||||
kp.write_batch(batch).unwrap_or_else(|e| {
|
||||
eprintln!("error: {e}");
|
||||
|
||||
Reference in new issue
Block a user