You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StaticArrayMap and StaticArrayMapWithEql are more alternatives to
StaticStringMap and StaticStringMapWithEql, the difference being that
they can have an array of any type of uniquely represented data as the
key, rather than just an array of u8.
StaticStringMapIgnoreCase has been added to provide a case-insensitive
definition of StaticArrayMap. While you *can* use StaticArrayMapWithEql,
StaticStringMapIgnoreCase is a common usecase of StaticStringMap while
also being optimized with SIMD.
The construction of StaticStringMap (provided by StaticArrayMap) has
changed to be comptime-only. This change allows us to greatly improve
the generated machine code through sorting the keys by length and
comparing multiple bytes at the same time. The breaking changes include:
- StaticStringMapWithEql interface has changed - specifically, take a
look at the function interface of the eql function, which now takes a
comptime-time known length, a comptime-time known array of an expected
key, a runtime-known array of the recieved key, and returns a boolean
indicating whether the two classify as matching.
- The getLongestPrefix and getLongestPrefixIndex functions have been
removed. They did not see much use.
As a result of these changes, performance is greatly improved. If you
have been using a runtime initialization of a StaticStringMap, consider
using comptime initialization or std.StaticStringMap.
Many test cases depended on getLongestPrefix, getLongestPrefixIndex, or
runtime initialization. Those test cases have been removed, as they are
no longer testing existing code.
0 commit comments