9 ms·
There’s an optimization technique I’ve used that I think could be useful for this kind of problem. It’s similar in spirit to the post. The post deals a lot bot
by returningfory2 3y ago
There’s an optimization technique I’ve used that I think could be useful for this kind of problem. It’s similar in spirit to the post.
The post deals a lot both with strings and maps with strings as keys. One idea is to intern these strings using an interer like [1] which returns string keys as monotonically increasing integers starting at 0. Then instead of a map you can just have a regular vector with the interned key as the index into the vector. This gives you the map functionality with very good performance.
[1] https://docs.rs/string-interner/latest/string_interner/ https://docs.rs/string-interner/latest/string_interner/