Skip to content
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

Remove distances from CH shortcuts #1719

Merged
merged 5 commits into from Sep 10, 2019
Merged

Conversation

easbar
Copy link
Member

@easbar easbar commented Sep 10, 2019

No longer store distances for CH shortcuts, they were not really used anyway.
This reduces memory consumption per shortcut by four bytes (now 9*4=36 bytes for node-based and 11*4=44 bytes for edge-based CH). To retrieve the distance of a shortcut one can use ShortcutUnpacker and sum all the distances of the underlying real edges (this is the way we did it for path extraction already).

Fixes #1690.

@easbar easbar added this to the 0.13 milestone Sep 10, 2019
Copy link
Member

@karussell karussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really clean. Nice!!

I can imagine that this makes preparation also a bit faster for German-sized installations or is the effect too small?

return ((CHEdgeIteratorState) edge).getWeight();
} else {
return weighting.calcWeight(edge, false, EdgeIterator.NO_EDGE);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there two cases now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah this is just a helper method in this test, only for convenience. previously I used weighting.calcWeight but since weighting is a shortest weighting here this is calling getDistance() (which causes an exception for shortcuts). In production code this is a bit different because we normally would use PreparationWeighting (but that does not have the instanceof check...).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@easbar
Copy link
Member Author

easbar commented Sep 10, 2019

I can imagine that this makes preparation also a bit faster for German-sized installations or is the effect too small?

Will try (its almost certainly not slower, but I am interested how such a change affects performance as well).

@easbar easbar merged commit 2106041 into master Sep 10, 2019
@easbar easbar deleted the remove_dists_from_shortcuts branch September 10, 2019 12:41
@easbar
Copy link
Member Author

easbar commented Sep 10, 2019

This and this commit seem to have improved the (node-based) CH preparation time by about 10-15% (tried this for Germany only)

@karussell
Copy link
Member

Wow, that is a huge number for already highly tuned stuff. Nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove the distance field from CH shortcuts
2 participants