mix bam.bench --records 500 ran on 2026-11-30. The figures below are copied from that run. They are one machine, one OTP, and one small synthetic file.

ItemValue
Elixir1.18.4
OTP28
Architectureaarch64-apple-darwin25.2.0
Schedulers10
samtools1.25, htslib 1.25
Records500
Fixture bytes2393
Compressionlevel 1, with a BAI sidecar
Referencechr1, length 1,000,000
Read shape8 bp M, positions 0, 1, 2, …

Each iteration opens the file, reads, and closes it. The stream iteration counts every record. The region iteration asks for chr1 positions [0, 200).

Benchee time: 2, memory_time: 1:

Jobipsaveragedeviationmedian99th %average memory
stream1.28 K0.78 ms±18.14%0.77 ms1.06 ms1.34 MB
region0.92 K1.09 ms±39.99%1.03 ms3.45 ms1.26 MB

Benchee reported region as 1.39× slower than stream (+0.31 ms) and as 0.94× the stream memory (−0.08432 MB). Memory is Benchee's per-iteration measurement of the benchmark function, which includes the open file and the decoded records. It is not a resident-set figure for a large production file.

No parallel inflate was measured. The 500-record file is too small to decide whether :zlib is the limiter on a whole-genome BAM. That comparison stays open.

This library and pysam

mix run bench/python_vs_elixir.exs -- --records 500 --iterations 40 --warmup 5 ran on 2026-11-30, after the Benchee table above. It writes the same 500-record file (2393 bytes, compression level 1, BAI sidecar) and times both readers on that file. Each iteration opens, reads, and closes. stream counts every record. region counts chr1 positions [0, 200). The script discards 5 warmup iterations, then reports the mean of 40. Both sides counted 500 records in stream and 200 in region.

ItemValue
Elixir1.18.4
OTP28
Python3.12.9
pysam0.24.1
Architectureaarch64-apple-darwin25.2.0
Records500
Fixture bytes2393
Iterations40, after 5 warmup
JobElixir meanpysam mean
stream0.751 ms0.232 ms
region1.182 ms0.126 ms

pysam 0.24.1 calls HTSlib. These means are not the Benchee numbers above: Benchee ran for 2 seconds and also measured memory. This table is one short loop on one small file. It is not a claim about a whole-genome BAM.

Re-run with mix run bench/python_vs_elixir.exs -- --records N and replace this section with that output. If pysam is not installed, the script prints pysam: not run and this section should say that instead of a time. Do not copy a number from a run that did not happen.