NREL / routee-compass

An energy-aware routing engine
https://nrel.github.io/routee-compass/
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

Use Specialized Map from CostModel in Adjacency Matrix #169

Closed robfitzgerald closed 7 months ago

robfitzgerald commented 7 months ago

The specialized Map type used in CostModel could also be applied to the HashMap<EdgeId, VertexId> maps in the adjacency matrix. Based on Nick's exploration, this gives a runtime improvement over basic HashMap for small HashMaps, and since that's the case with road networks (out edges are typically on the order of 2-4), we should see a large benefit from this.

Bonus points: create a generic enum SpecializedHashMap<K: Hash, V> that implements these optimizations for any arbitrary K, V.