graphhopper / graphhopper/graphhopper
Speed up reading of turn costs
- Dominant language
- Java
- Stars
- 6.7k
- Forks
- 2k
- Avg merge
- 15h 58m
- Merged PRs (30d)
- 3
Description
Currently we have this method in `TurnCostStorage`:
```java
public double get(DecimalEncodedValue turnCostEnc, int fromEdge, int viaNode, int toEdge)
```
but it has two issues:
1) It creates a new `IntsRef` object on every call, even though all it returns is a double
2) It traverses the whole turn cost table for the given `viaNode`: For every node we store a list of entries `TC_FROM|TC_TO|TC_FLAGS|TC_NEXT` and calling the `get` method above traverses all of them and returns the first match. However, in practice we are typically only interested in the turn costs at a given node for a fixed `fromEdge` (or `toEdge`) and it would be better if we were able to skip the entries for other `from/to` edges right away.
Related: #269, #1945
Contributor guide
Research direction
Start in TurnCostStorage at the get(DecimalEncodedValue, int, int, int) method and inspect its callers and the turn-cost table traversal. Related issues #269 and #1945 may provide context for the intended lookup strategy. Done means preserving returned turn costs while avoiding the per-call IntsRef allocation and skipping irrelevant from/to-edge entries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100