-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize StaticStringMap, add StaticArrayMap. Remove runtime .init()
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.
- Loading branch information
1 parent
42dac40
commit 86bf50c
Showing
8 changed files
with
518 additions
and
638 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.