From ac3835227eb66ea340122db614e6f32fa17a5697 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 11 Apr 2022 01:44:25 -0700 Subject: [PATCH] Update comptime_string_map.zig --- src/comptime_string_map.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/comptime_string_map.zig b/src/comptime_string_map.zig index b4cc733e19..546f928c9d 100644 --- a/src/comptime_string_map.zig +++ b/src/comptime_string_map.zig @@ -85,6 +85,8 @@ pub fn ComptimeStringMapWithKeyType(comptime KeyType: type, comptime V: type, co comptime var i = len_indexes[len]; + // This benchmarked faster for both small and large lists of strings than using a big switch statement + // But only so long as the keys are a sorted list. inline while (i < end) : (i += 1) { if (strings.eqlComptimeCheckLenWithType(KeyType, str, kvs[i].key, false)) { return kvs[i].value;