From ff58f09b68de08a5fe33177f1874c677c762c1c0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 6 Sep 2020 16:23:18 +0200 Subject: [PATCH] Use better haystack size and needle size for cutoff between linear and BMH --- lib/std/mem.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/mem.zig b/lib/std/mem.zig index 33d021eded..a1951943d6 100644 --- a/lib/std/mem.zig +++ b/lib/std/mem.zig @@ -927,7 +927,7 @@ pub fn indexOfPos(comptime T: type, haystack: []const T, start_index: usize, nee if (needle.len > haystack.len) return null; if (needle.len == 0) return 0; - if (!meta.trait.hasUniqueRepresentation(T) or haystack.len < 32 or needle.len <= 2) + if (!meta.trait.hasUniqueRepresentation(T) or haystack.len < 52 or needle.len <= 4) return indexOfPosLinear(T, haystack, start_index, needle); const haystack_bytes = sliceAsBytes(haystack);