2 ms·
They did do that at first; the “static Vec” reference is to this. A Vec<T> is a growable array type. Arrays have O(n) lookup in the worst case, and HashMaps ha
by steveklabnik 2y ago
They did do that at first; the “static Vec” reference is to this. A Vec<T> is a growable array type.
Arrays have O(n) lookup in the worst case, and HashMaps have O(1), as the post mentions. Basically, you have to walk through the entire array of the header you’re looking for is at the end, whereas it’s always cheap with a HashMap. But the trie is even better!
Basically, none of this is Rust specific, it’s just algorithms stuff.