Skip to content

nix vertices hash table #162

Closed
TravelMapping/DataProcessing
#429

Description

@yakra

std::unordered_map<Waypoint*, HGVertex*> vertices;

Replacing this with a HGVertex* within each Waypoint might improve...

  • Speed:
    • No need to build a hash table, or any of the temporary structures used in its creation.
      Just assign the pointer a value. Threadsafe!
    • Grabbing our vertex location from a known location within a waypoint should be faster than messing about with hash tables.
  • RAM:
    • About 1/3 of waypoints won't reference a vertex, and their pointers will be unnecessary, but this is more than outweighed by avoiding storing two pointers for the other 2/3, + the overhead of the std::unordered_map container.
      ...Or not. We still need some container to iterate through...

I don't expect these changes would have the same impact in Python with its wibbly-wobbly type system.

Activity

  1. changed the title [-]nix 2020-12-29 hash table[/-] [+]nix vertices hash table[/+] on May 14, 2021
  2. added and removed on May 14, 2021
  3. yakra commented on May 14, 2021

    @yakra
    OwnerAuthor

    Mm yes. Quite nice. Compare to the previous graph here.
    Vert_nix
    This also yields improvements beyond just Creating unique names and vertices.
    Before & After times:

    task BT lab1 lab1.5 lab2 lab3
    Creating edges 2.75
    1.979
    1.586
    1.139
    1.862
    1.374
    1.945
    1.431
    2.531
    1.911
    Compressing collapsed edges 1.47
    1.263
    0.855
    0.711
    1.057
    0.908
    1.022
    0.878
    1.312
    1.137
    Writing master TM graph files 7.086
    6.443
    6.059
    5.461
    4.369
    3.856
    7.474
    6.632
    9.539
    8.668
    Creating area data graphs 1.394
    1.04
    0.569
    0.558
    0.588
    0.582
    0.691
    0.68
    0.885
    0.866

    Times were measured with siteupdateST. Partly for simplicity, and also because:

    • Creating & collapsing edges is still a single-threaded task anyway
    • Area graph times could be polluted by adjacent region or multiregion graphs if multi-threaded
    • Can't find master graph end time when multi-threaded. Time could be thrown off by concurrent DB writing, even with siteupdate -t 1
  4. yakra commented on May 15, 2021

    @yakra
    OwnerAuthor

    Python:

    I don't expect these changes would have the same impact in Python with its wibbly-wobbly type system.

    Indeed, we only save about 0.1s. Going no-build for the sake of keeping a simpler commit history.

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