Skip to content

Makes QueryGraph's edge-explorer cache work for all EdgeFilters, fixes #1623. - #1624

Merged
easbar merged 6 commits into
masterfrom
issue1623
May 29, 2019
Merged

easbar merged 6 commits into
masterfrom
issue1623

Conversation

@easbar

@easbar easbar commented May 28, 2019

Copy link
Copy Markdown
Member
  1. QueryGraph caches edge-explorers based on the identity of the EdgeFilters passed into createEdgeExplorer
  2. fixes edge-based CH in combination with edge-explorer cache (by setting explicit filter ids)
  3. deprecates creators of DefaultEdgeFilter using FlagEncoder (and adds new ones taking only access encoded value instead)
  4. replaces PrepEdgeFilter with DefaultEdgeFilter in PrepareRoutingSubnetworks (it did not really do anything different than DefaultEdgeFilter#allEdges).

Most changed files are due to 3), and not sure about this.

WDYT ? I can also revert this.

@easbar easbar changed the title Makes QueryGraph's edge-explorer independent of filter type, fixes #1623. Makes QueryGraph's edge-explorer cache work for all EdgeFilters, fixes #1623. May 28, 2019
@karussell

Copy link
Copy Markdown
Member

Thanks, this looks good.

Regarding the deprecation: this would be nice if the actual code amount reduces somehow. We would need to get rid of the FlagEncoder usage of the calling side first i.e. instead of encodingManager.getFlagEncoder("xy").getAccessEnc() we would do encodingManager.getEncodedValue("car.access") or something. Probably we should indeed move this into a separate issue as this is more related to reducing the usage of FlagEncoder. I would still provide the new method for better migration, just remove the deprecation?

Furthermore I would remove the acceptsForward&Backwards methods as I cannot find a usage, or do you think this would be too ugly?

@easbar

easbar commented May 28, 2019

Copy link
Copy Markdown
Member Author

to get rid of the FlagEncoder usage of the calling side first

I checked and in many cases this is what changed:

- outEdgeExplorer = graph.createEdgeExplorer(DefaultEdgeFilter.outEdges(flagEncoder));
+ outEdgeExplorer = graph.createEdgeExplorer(DefaultEdgeFilter.outEdges(flagEncoder.getAccessEnc()));

Typically the flagEncoder field of the classes where this happens is not used for anything else and the flagEncoder field could be replaced with a boolean encoded value there already. But I agree this is not the right place to do such refactoring.

Probably we should indeed move this into a separate issue as this is more related to reducing the usage of FlagEncoder. I would still provide the new method for better migration, just remove the deprecation?

Ok yes any further changes should go in a separate issue, but should we keep the changes (like the ones above) or do you want to revert this ? Either way is fine for me. If we keep the changes why not keep the deprecation ? The method taking a flag encoder is no longer used, but I thought it would be easier to adopt downstream when the method is kept and only deprecated. If we change back to .in/outEdges(encoder) everywhere sure we should also remove the @Deprecated annotations.

Furthermore I would remove the acceptsForward&Backwards methods as I cannot find a usage, or do you think this would be too ugly?

Ok.

@karussell

Copy link
Copy Markdown
Member

Typically the flagEncoder field of the classes where this happens is not used for anything else

Yes, exactly. I would either reduce the FlagEncoder usage also on the calling side (new issue) or keep using the old and shorter variant. Still it would be also no problem if you keep it to save time and schedule the changes for later :)

If we keep the changes why not keep the deprecation?

Good question - convinced ;)

@easbar

easbar commented May 29, 2019

Copy link
Copy Markdown
Member Author

Ok I reverted to the old shorter variant and removed the deprecation.

private final int mainEdges;
private final QueryGraph baseGraph;
private final GraphExtension wrappedExtension;
// TODO when spreading it on different threads we need multiple independent explorers

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.

what about this todo ? should we keep it ? The current caching mechanism is not thread safe, but the edge-explorer creation is not spread on different threads either.

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.

Yes, this can be removed.

@easbar

easbar commented May 29, 2019

Copy link
Copy Markdown
Member Author

The build failed with

Minutely API limit heavily violated: 300.6 >= 200.0. Find the details at the bottom of the page https://www.graphhopper.com/pricing/

@karussell

Copy link
Copy Markdown
Member

The build failed with

Oh, likely too many tests in parallel (maybe also some misusage). Have increased this limit for now and triggered the build again.

@easbar
easbar merged commit 2f8072d into master May 29, 2019
@easbar
easbar deleted the issue1623 branch May 29, 2019 14:45
@easbar

easbar commented May 29, 2019

Copy link
Copy Markdown
Member Author

I moved the (now reverted) flagEncoder vs encoded value refactoring code changes to here: #1625

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.

2 participants