Skip to content

Avoid per-site copies when writing VCF - #3513

Closed
rpinho wants to merge 2 commits into
tskit-dev:mainfrom
rpinho:perf-vcf-export-speed
Closed

rpinho wants to merge 2 commits into
tskit-dev:mainfrom
rpinho:perf-vcf-export-speed

Conversation

@rpinho

@rpinho rpinho commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

write_vcf constructs site and mutation records to find each site's ID and copies each decoded variant. Stream variants when there is no sample mask, use sample lists when the sample order matches, and write genotype digits into the output buffer. Exporting 10,000 samples and 213,963 sites to the null device took 2.06 seconds instead of 5.60 seconds, with matching output digests. The VCF tests check the export options and that a sample-mask callback can retain the variants it receives.

PR Checklist:

  • Tests that fully cover new/changed functionality.
  • Documentation including tutorial content if appropriate.
  • Changelogs, if there are API changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

@jeromekelleher

Copy link
Copy Markdown
Member

Thanks for the contributions @rpinho. Similar to my question in tskit-dev/msprime#2554, I would like to get a sense of the motivation behind these contributions. My sense is that VCF output speed is not really a bottleneck for most workflows, and so this optimisation (which requires review effort) may not be worth the overall time investment. If this is something that you, personally, need for your work, we are of course happy to work with you.

@rpinho

rpinho commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for asking. Code analysis, not usage. I'm trying to play around with AI for science. I'm doing this with AI agents, so if these aren't useful, I'll close them.

@rpinho rpinho closed this Nov 19, 2026
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.

2 participants