You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Skip storing an explicit node_id in RouteGraphNode
`RouteGraphNode` is the main heap entry in our dijkstra's next-best
heap. Thus, because its rather constantly being sorted, we care a
good bit about its size as fitting more of them on a cache line can
provide some additional speed.
In 43d250d, we switched from
tracking nodes during pathfinding by their `NodeId` to a "counter"
which allows us to avoid `HashMap`s lookups for much of the
pathfinding process.
Because the `dist` lookup is now quite cheap (its just a `Vec`),
there's no reason to track `NodeId`s in the heap entries. Instead,
we simply fetch the `NodeId` of the node via the `dist` map by
examining its `candidate`'s pointer to its source `NodeId`.
This allows us to remove a `NodeId` in `RouteGraphNode`, moving it
from 64 to 32 bytes. This allows us to expand the `score` field
size in a coming commit without expanding `RouteGraphNode`'s size.
While we were doing the `dist` lookup in
`add_entries_to_cheapest_to_target_node` anyway, the `NodeId`
lookup via the `candidate` may not be free. Still, avoiding
expanding `RouteGraphNode` above 128 bytes in a few commits is a
nice win.
0 commit comments