zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit ff58f09b68de08a5fe33177f1874c677c762c1c0 (tree)
parent 8af1f8ba1ad43a750e0040ac845b331241ead329
Author: dec05eba <dec05eba@protonmail.com>
Date:   Sun,  6 Sep 2020 16:23:18 +0200

Use better haystack size and needle size for cutoff between linear and BMH

Diffstat:
Mlib/std/mem.zig | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 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);