Skip to content

Commit

Permalink
Using memcmp with a fixed length leads to very efficient assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpvorderman committed Dec 11, 2023
1 parent a3147cc commit 2afb88c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dnaio/_core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ cdef class FastqIter:
second_header_start = sequence_end + 1
remaining_bytes = (buffer_end - second_header_start)
# Usually there is no second header, so we skip the memchr call.
if remaining_bytes > 2 and second_header_start[0] == b'+' and second_header_start[1] == b'\n':
if remaining_bytes > 2 and memcmp(second_header_start, b"+\n", 2) == 0:
second_header_end = second_header_start + 1
else:
second_header_end = <char *>memchr(second_header_start, b'\n', <size_t>(remaining_bytes))
Expand Down

0 comments on commit 2afb88c

Please sign in to comment.