Skip to content

norm: decode each tag once when splitting multiallelic records - #2620

Open
BenjaminDEMAILLE wants to merge 1 commit into
samtools:developfrom
BenjaminDEMAILLE:perf/norm-split-decode-once
Open

BenjaminDEMAILLE wants to merge 1 commit into
samtools:developfrom
BenjaminDEMAILLE:perf/norm-split-decode-once

Conversation

@BenjaminDEMAILLE

@BenjaminDEMAILLE BenjaminDEMAILLE commented Nov 24, 2026 •

Copy link
Copy Markdown

When splitting multiallelics, I saw that split_multiallelic_to_biallelics() decodes every INFO and FORMAT tag once per ALT. I changed it to decode each tag once, cache it, and copy it into the scratch buffer for each ALT (the split functions modify it in place). The output doesn't change, and records with a single ALT aren't affected.

norm -m- on a synthetic gnomAD-like file (20k sites x 6 ALTs, 200 samples) went from 2.39s to 1.86s CPU with -Ou for me. make test passes.

I adapted it from pasta (https://github.com/DylanCosto/pasta, MIT).

I've listed this with my other performance PRs in samtools/htslib#2175.

Assisted-by: Claude:claude-opus-5-5

split_multiallelic_to_biallelics() decoded every INFO and FORMAT tag
once per ALT.  Decode once, cache, and copy to the scratch buffer per
ALT (the split_* functions modify it).  Output is unchanged.

norm -m- on 20k sites x 6 ALTs, 200 samples: -Ou 2.39s -> 1.86s CPU.

Idea from pasta (https://github.com/DylanCosto/pasta, MIT).

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Benjamin Demaille <benjamin.demaille@icloud.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant