Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed-up reading of large header files #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

astaric
Copy link

@astaric astaric commented Jun 9, 2022

When a large file was passed to the -H parameter, bwa-mem2 spent more than 10 minutes just reading the lines from the file (I experienced this on a 70MB file with ~1.5M lines).

This was caused by computing the length of the already parsed header and reallocating the string for every single line in the input file resulting in quadratic complexity. The new implementation allocates a buffer that is able to fit the whole file up front and then reads all "valid" lines into the buffer before calling the original bwa_insert_header implementation. With this change the reading of header file takes <1s.

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.

None yet

1 participant