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
When reversing the flags this is an expensive operation as also flag encoders that are not used for one specific traversal have to be properly swapped. Instead we could define one bit (e.g. first) which we use as indication for "forward storage" or "reverse storage", then on access of direction dependent properties like speed we can access the bit ranges dependent on this bit0:
classSomeFlagEncoder {...
doublegetSpeed(flags) {
if(isBit0Set(flags)) // if bit0 is 1 this defines 'forward'returnforwardSpeedEncoder.getDoubleValue(flags);
returnreverseSpeedEncoder.getDoubleValue(flags);
}}
This way we can reduce the whole EncodingManager.reverseFlags method to one bit operation flipping the first bit, avoiding the loop and avoiding all swap operations (i.e. unrelated and even related). But introducing the isBit0Set for all direction dependent properties.
We could even avoid to store the direction with this one bit. Instead we could use the nodeA and nodeB as direction indication (e.g. nodeA>nodeB defines as 'forward') and store the flags accordingly. The only problem then would be that one would need to create the flags either in forward or in backward direction dependent on this low level storage which would be too ugly or we still need one potential reverseFlags call at least at writing time. Also the bit0 solution is edge independent and would work without #472.
Take into account shortcuts of CHGraph. See EdgeAccess.reverseFlags where we swap the two accessibility bits and now would need to read the forward&backward property dependent on bit0
Activity
karussell commentedon Feb 19, 2019
Fixed via #1447