Skip to content

Remove acceptWay optimization #2462

Closed

Description

@easbar

It goes like this:

  • During pass1 of the OSM import we call EncodingManager#acceptWay for every OSM way (except those with only one node or no tags). acceptWay calls getAccess for each FlagEncoder which returns either WAY, FERRY or CAN_SKIP for each way. The value OTHER is never used (at least not here). However, it then only checks whether or not any of the encoders returned something other than CAN_SKIP. So basically there is nothing to optimize here: We need to call getAccess once per way for each encoder. The distinction between FERRY and WAY is not used.

  • pass2 is more interesting: We do the same as in pass1 (filter out all ways for which EncodingManager#acceptWay is false, but besides filtering the ways we also need to calculate the edge flags for each way. This is done in EncodingManager#handleWayTags, which takes an AcceptWay (the result of EncodingManager#acceptWay as input parameter. This allows a potential optimization: We can reuse the result of the first acceptWay call here.

However, we do not even do this optimization anymore since #2448. I therefore tried putting it back here: fa7c84b and it turns out there is no measurable speedup, and even more so there is no significant speedup that really justifies this added complexity it seems. I also tried doing this with more (5) flag encoders. Even when I repeated the acceptWay check eleven times the slowdown was still only around 50%. I think we should remove this.

The first step would probably be adding public IntsRef handleWayTags(ReaderWay way, IntsRef relationFlags) to EncodingManager (without the acceptWay parameter) and calling acceptWay inside. But then we should also remove the ferry parameter from TagParser#handleWayTags and remove the acceptWay parameter from AbstractFlagEncoder#handleWayTags.

Activity

  1. easbar commented on Nov 18, 2021

    @easbar
    MemberAuthor

    We should fix #2465 before this.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions