Repository navigation
Edge flags refactoring - #1447
Conversation
12f4887 to
5c3d229
Compare
395e3b0 to
1c917c7
Compare
85cf3d9 to
037704b
Compare
|
Ok, I'm now happy with the scope of the change and I think this PR is in a good shape. All tests are green and performance is also ok, so we have something we can work on. Before a merge we would need to test this on a world wide instance and also I need to know if it satisfies some of the use cases we had before (like external edge data etc). So I would need feedback regarding the EncodedValue-API, maybe @ammagamma & @michaz can have a look and already work a bit with it? Another question is if we should use IntsRef or LongsRef. Currently we have not implemented a cross-int EncodedValue i.e. if you have two EncVs with 20 bits then the second one will be in the next int and 12 bits are unused. Maybe one can implement a cross-int solution (like we partially had before via ints-merging) or maybe we reduce problems with a LongsRef? The best thing would be to hide this decision as much as possible and make it trivial to change it later. Maybe we can then keep using IntsRef as also the underlying DataAccess for edges is of type |
|
It's clever to separate direction-dependent and non-direction-dependent features. reverse speed is slow, though if the bits are same it could be optimized. |
|
What do you mean? btw: the underlying implementation could be easily changed (have several experiments done but as a start simplicity is more important), so that e.g. the value and its delta are stored like we do now for landmarks instead forward+backward values. |
991e7cf to
cffad50
Compare
af6171a to
f0999d9
Compare
Signed-off-by: easbar <[email protected]>
Signed-off-by: easbar <[email protected]> # Conflicts: # core/src/test/java/com/graphhopper/routing/ch/PrepareContractionHierarchiesTest.java
…rong. Signed-off-by: easbar <[email protected]>
…ew method for node- and edge-based CH. Signed-off-by: easbar <[email protected]>
Signed-off-by: easbar <[email protected]>
Signed-off-by: easbar <[email protected]>
… CHEdgeIteratorImpl. Signed-off-by: easbar <[email protected]>
|
@easbar Do you think this change makes this PR a bit cleaner or at least more consistent of CH and none-CH stuff? There are two tiny advantages: the weight is 1 bit more precise and setWeight and access handling is independent, i.e. you do not need to call one before the other or something. I wasn't able to measure any performance difference but will do again with some improved measurement stuff. After we decided this I would finally merge this PR. There is also this lazy loading commit, but I do not like this pattern that much. |
Ok I have not looked at the change you mentioned yet, should I wait for more changes or have a look ? |
|
Ok, after some more tests this is now merged. Instead of the lazy loading commit we decided to use the intsref_no_iter_cached that gave a minor boost for CH preparation. BTW: @easbar finally I got the co author thing working :D |
| public EdgeIteratorState detach(boolean reverse) { | ||
| if (reverse) { | ||
| // update properties of reverse edge | ||
| // TODO copy wayGeometry too |
There was a problem hiding this comment.
Did you mean pointList with wayGeometry here ?
There was a problem hiding this comment.
yes (-> PointList fetchWayGeometry(int mode) and setWayGeometry(PointList list) )
Mainly this PR avoids the 64 bit limitation of getFlags and makes working with edge properties much easier (direction-dependent or not):
It is now very easy to enable direction-dependent values, just with a boolean flag in the constructor. One can now easily introduce FlagEncoder-independent values like we did already with the roundabout boolean. One can now easier use external edge data as there is no need to define a direction bit and one uses the reverse property of the EncodedValue (see REVERSE_STATE or graph.getEdgeIteratorState returns stored direction). And also the EncodedValues are independent of any OSM tags, interesting for other data sets like GTFS. This change also reduces the usage of getFlags until we can make it private at some point.
This PR fixes at least #472, #1164 and #728. This will come after 0.11.
The goal was to make a 'minimal' version of #1112 without introducing new features like TagParser and also we did not yet remove FlagEncoders. Also performance seems to be the same. All other features could be introduced later.
Done:
speedDefaultvariable in AbstractFlagEncoder as a0should be interpreted as 0km/h and not as the default value in the new DecimalEncodedValue classbits == 0like before as for spatialEncoder this change was required. The dynamic EncodedValue creation needs a different way instead of creating many unused&empty EncodedValuesTODOs:
Later improvements: