Difftastic spends a remarkable 49% of its runtime just reading and writing to a FxHashMap of ~1 million items. This hashmap stores the predecessor vertex when calculating the shortest route.

I'm running out of ideas. I can't use perfect hashmaps, are there other speed tricks?


Update: I should have noticed that calling .get() and .insert() on a hashmap is slower than using .entry(), it saves a lookup!

Fixing this saves up to 6% of runtime -- not huge, but doesn't hurt.

Sign in to participate in the conversation

The original server operated by the Mastodon gGmbH non-profit