On Friday, 19 January 2024 at 16:55:25 UTC, ryuukk_ wrote:

You do hash map lookup for every character in D, it's slow, whereas in Rust you do it via pattern matching, java does the same, pattern matching


Yet another reason to advocate for pattern matching in D and switch as expression

There is another important difference, i quickly looked up D associative array implementation and the search looks like nlog(n) complexity with plain loop iteration of hashes, whereas rust's implementation is using "swisstable" algorithm implementation that has packed SIMD optimized lookups, this is likely where the 3x speed difference comes from.

Tried to look up rust implementation and it is SOOO generic that I was unable to decipher it to find the actual key search and stores.

Anyway here is an interesting article about rust implementation
https://faultlore.com/blah/hashbrown-tldr/

Reply via email to