-
In my experiment, "zlib-ng" enabled noodles-bam reader was about 36% faster, even faster than rust-htslib. zlib-ng
Normal
const TEST_BAM2: &str = "NA12878.mapped.ILLUMINA.bwa.CEU.low_coverage.20121211.bam";
const BAM2_CHR1_LEN: usize = 12903629;
const SAMPLE_SIZE: usize = 100;
const MAX_ITER: usize = 200000;
const CHROM: &str = "13";
let mut reader = bam::io::indexed_reader::Builder::default()
.build_from_path(TEST_BAM2)
.unwrap();
let header = reader.read_header().unwrap();
let region = CHROM.parse().unwrap();
let mut query = reader.query(&header, ®ion).unwrap().into_reader();
let mut i_iter = 0..MAX_ITER;
let mut record = Record::default();
while let (Ok(true), Some(_)) =
(query.read_record(&mut record).map(|n| n > 0), i_iter.next())
{
std::str::from_utf8(record.name().unwrap().as_bytes()).unwrap();
record.alignment_start().unwrap().unwrap();
record.template_length();
} |
Beta Was this translation helpful? Give feedback.
Answered by
zaeleus
May 16, 2024
Replies: 1 comment 1 reply
-
Rust features are additive. You can select the flate2 backend by adding it as a dependency to your application and enabling the desired feature set, i.e., flate2 = { version = "1.0.30", default-features = false, features = ["zlib-ng"] } Also note that noodles-bgzf supports linking to libdeflate via the noodles-bgzf = { version = "0.29.0", features = ["libdeflate"] } |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Crispy13
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rust features are additive. You can select the flate2 backend by adding it as a dependency to your application and enabling the desired feature set, i.e.,
Also note that noodles-bgzf supports linking to libdeflate via the
libdeflate
feature. This will typically yield better performance than general-purpose DEFLATE implementations.