Skip to content

Commit

Permalink
Backport htslib/kseq.h parsing performance improvement (PR #1227)
Browse files Browse the repository at this point in the history
Apply the main part of PR samtools/htslib#1674. Pysam does use kseq itself,
so it is worth applying this now without waiting for the next HTSlib release
to be imported.

Co-Authored-By: Fabian Klötzl <fabian@kloetzl.info>
  • Loading branch information
valentynbez and kloetzl committed Sep 28, 2023
1 parent adf52b9 commit 7d1df29
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions htslib/htslib/kseq.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
} else break; \
} \
if (delimiter == KS_SEP_LINE) { \
for (i = ks->begin; i < ks->end; ++i) \
if (ks->buf[i] == '\n') break; \
unsigned char *sep = memchr(ks->buf + ks->begin, '\n', ks->end - ks->begin); \
i = sep != NULL ? sep - ks->buf : ks->end; \
} else if (delimiter > KS_SEP_MAX) { \
for (i = ks->begin; i < ks->end; ++i) \
if (ks->buf[i] == delimiter) break; \
Expand Down

0 comments on commit 7d1df29

Please sign in to comment.