Skip to content

Remove distances from CH shortcuts - #1719

Merged
easbar merged 5 commits into
masterfrom
remove_dists_from_shortcuts
Sep 10, 2019
Merged

easbar merged 5 commits into
masterfrom
remove_dists_from_shortcuts

Conversation

@easbar

@easbar easbar commented Sep 10, 2019 •

Copy link
Copy Markdown
Member

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

@karussell karussell left a comment •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok

@easbar

easbar commented Sep 10, 2019

Copy link
Copy Markdown
Member Author

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

easbar commented Sep 10, 2019

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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