aboutsummaryrefslogtreecommitdiff
path: root/src/comptime_string_map.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-04-11 01:44:25 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-04-11 01:44:25 -0700
commitac3835227eb66ea340122db614e6f32fa17a5697 (patch)
tree62e3ee5c41731f18f303750b60c77cd06846b028 /src/comptime_string_map.zig
parentc6393bcd27b376ec07d7d9b8606791b4db33fcaf (diff)
downloadbun-ac3835227eb66ea340122db614e6f32fa17a5697.tar.gz
bun-ac3835227eb66ea340122db614e6f32fa17a5697.tar.zst
bun-ac3835227eb66ea340122db614e6f32fa17a5697.zip
Update comptime_string_map.zig
Diffstat (limited to 'src/comptime_string_map.zig')
-rw-r--r--src/comptime_string_map.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/comptime_string_map.zig b/src/comptime_string_map.zig
index b4cc733e1..546f928c9 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;