Skip to content

Graph sorting inflates StringIndex size #2170

Closed

Description

@otbutz

Describe the bug

The size of the StringIndex increases if grap.do_sort is enabled.

Size comparison of string_index_vals with austria-latest.osm.pbf:

  • unsorted: 6.1MB
  • sorted: 8.1MB

To Reproduce

Run an import with graph.do_sort: false and one with graph.do_sort: true and compare the size of the resulting string_index_vals.

Expected behavior

Sorting the graph shouldn't impact the StringIndex size.

See: https://discuss.graphhopper.com/t/with-graph-do-sort-getting-too-many-names-are-stored-currently-limited-to-int-pointer-error/6091

Activity

  1. otbutz commented on May 27, 2021

    @otbutz
    ContributorAuthor

    Possible cause:

    // This is a very important compressing mechanism due to the nature of OSM. Make this faster via precalculated hastcodes?
    if (entryMap.equals(lastEntryMap))
    return lastEntryPointer;

    The sorted graph probably renders this optimization useless.

  2. otbutz commented on Nov 19, 2021

    @otbutz
    ContributorAuthor

    This is sadly not fixed by 48d2c93

  3. karussell commented on Mar 27, 2023

    @karussell
    Member

    The StringIndex, now named KVStorage, is append only and "caches" its values only if the last entry is identical so it makes sense that this is increased. For sorting it would be require to create a new instance of KVStorage as we do for the graph itself too.

  4. otbutz commented on Mar 27, 2023

    @otbutz
    ContributorAuthor

    Maybe we can simply "renumber" the index keys instead of recreating it?

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions