From 2afb88c4e01881c8daf6e7e18f0107fa37696a1d Mon Sep 17 00:00:00 2001 From: Ruben Vorderman Date: Mon, 11 Dec 2023 11:36:17 +0100 Subject: [PATCH] Using memcmp with a fixed length leads to very efficient assembly --- src/dnaio/_core.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dnaio/_core.pyx b/src/dnaio/_core.pyx index 288a9f8..12f352d 100644 --- a/src/dnaio/_core.pyx +++ b/src/dnaio/_core.pyx @@ -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 = memchr(second_header_start, b'\n', (remaining_bytes))