feat: add obilayeredmap crate for disk-backed k-mer indexing
Introduces the `obilayeredmap` crate (v0.1.0), implementing an append-only, disk-backed k-mer index using a minimal perfect hash function (MPHF). The module features memory-mapped reads, buffered writes, custom error handling, partition metadata persistence, and comprehensive unit tests. Also adds a reverse complement benchmark for `obikseq` and updates `Cargo.lock` with the new dependencies.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
use criterion::{BatchSize, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
|
||||
use obikseq::packed_seq::PackedSeq;
|
||||
use obikseq::superkmer::SuperKmer;
|
||||
use obikseq::Sequence;
|
||||
|
||||
const LENGTHS: &[usize] = &[1, 4, 8, 16, 40, 64, 128, 255, 256];
|
||||
|
||||
@@ -50,12 +52,12 @@ fn bench_write_ascii(c: &mut Criterion) {
|
||||
fn bench_revcomp(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("revcomp");
|
||||
for &len in LENGTHS {
|
||||
let sk = SuperKmer::from_ascii(&make_ascii(len));
|
||||
let seq = PackedSeq::from_ascii(&make_ascii(len));
|
||||
group.throughput(Throughput::Bytes(len as u64));
|
||||
group.bench_with_input(BenchmarkId::from_parameter(len), &sk, |b, sk| {
|
||||
group.bench_with_input(BenchmarkId::from_parameter(len), &seq, |b, seq| {
|
||||
b.iter_batched(
|
||||
|| sk.clone(),
|
||||
|mut s| { std::hint::black_box(&mut s).revcomp(); s },
|
||||
|| seq.clone(),
|
||||
|s| { let mut s = std::hint::black_box(s); s.revcomp_inplace(); s },
|
||||
BatchSize::SmallInput,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user