Skip to content

Reduce node id lookups in OSMReader #2194

Closed

Description

@otbutz

According to my recent benchmarks the OSMReader spends about 25% of its execution time looking up node ids:

GHLongIntBTree

It should be enough to avoid some unnecessary lookups like here:

LongIntMap nodeFilter = getNodeMap();
ReaderElement item;
while ((item = in.getNext()) != null) {
switch (item.getType()) {
case ReaderElement.NODE:
if (nodeFilter.get(item.getId()) != EMPTY_NODE) {
processNode((ReaderNode) item);
}
break;

protected void processNode(ReaderNode node) {
if (isInBounds(node)) {
addNode(node);

boolean addNode(ReaderNode node) {
int nodeType = getNodeMap().get(node.getId());

We could pass the internal node id through and avoid the additional lookups.

Activity

  1. otbutz commented on Nov 27, 2020

    @otbutz
    ContributorAuthor

    Tried to reduce the lookups and even switched to a LongIntHashMap but no significant difference.

    A BloomFilter could probably help a lot if we create it based on the nodes in the preprocess step.

  2. easbar commented on Nov 2, 2021

    @easbar
    Member

    I think since #2448 and 5a36977 there is not really potential to further reduce the number of lookups. Closing for now, but of course feel free to open again if you think otherwise.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions