-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore unused egress modes in network preloader #789
Conversation
this avoids building huge bike egress tables when that egress mode is specified but no transit is enabled. later during routing, the egress tables should only be retrieved by the PerTargetPropagater which should only be created when transit is in use.
@@ -186,7 +184,11 @@ public Key (AnalysisWorkerTask task) { | |||
// transit is used). See code in TravelTimeComputer for when each is used. | |||
// Egress modes must be tracked independently since we need to build EgressDistanceTables for those. | |||
this.allModes = LegMode.toStreetModeSet(task.directModes, task.accessModes, task.egressModes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that the egress modes are still added to the "all modes" enum set. Do we want that to occur?
The following snippet could be used in order to create the "all modes" enum set from the filtered egress modes set:
// Egress modes must be tracked independently since we need to build EgressDistanceTables for those.
this.egressModes = LegMode.toStreetModeSet(
// Avoid unnecessarily building egress tables by
// ignoring spurious egress modes in requests that do not have transit enabled.
task.transitModes.isEmpty() ? EnumSet.noneOf(LegMode.class) : task.egressModes
);
// We need to link for all of access modes, egress modes, and direct modes (depending on whether
// transit is used). See code in TravelTimeComputer for when each is used.
this.allModes = LegMode.toStreetModeSet(task.directModes, task.accessModes);
this.allModes.addAll(this.egressModes);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, great suggestion. My change was skipping only the egress table construction, this should also skip the linkage step. Maybe the cleanest way of all would be to empty out the task.egressModes when task.transitModes.isEmpty(), but I didn't do it this way because there is no precedent for mutating/inferring fields of the supplied task so it was a bigger conceptual change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may still be "over-linking" because I believe the access mode linkages also won't be touched if transit is not used. Linking is usually faster than egress table building so this may not have much impact. We may eventually want to rewrite this so the preloader key has egressModes
and linkageModes
instead of allModes
, but for now I think it's better to stick with this minimally disruptive change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
This avoids building huge bike egress tables when that egress mode is specified but no transit is enabled. later during routing, the egress tables should only be retrieved by the PerTargetPropagater which should only be created when transit is in use.