Skip to content

TravelerList dicts #353

Closed
Closed

Description

@yakra

It appears we calculate & store data here, but never retrieve & use it.

# "traveled" dictionaries indexed by system name, then conn or regular
# route in another dictionary with keys route, values mileage
# "clinched" dictionaries indexed by system name, values clinch count
t.con_routes_traveled = dict()
t.con_routes_clinched = dict()
t.routes_traveled = dict()
#t.routes_clinched = dict()

std::unordered_map<HighwaySystem*, std::unordered_map<ConnectedRoute*, double>> con_routes_traveled; // mileage per ConRte per system
// TODO is this necessary?
// ConRtes by definition exist in one system only
std::unordered_map<Route*, double> routes_traveled; // mileage per traveled route
std::unordered_map<HighwaySystem*, unsigned int> con_routes_clinched; // clinch count per system
//std::unordered_map<HighwaySystem*, unsigned int> routes_clinched; // commented out in original siteupdate.py

  • Getting rid of these structures & their contents should free up some RAM, and maybe speed things up a tiny bit.

  • userlog.cpp: system_con_umap (system_con_dict in Python) can also go bye-bye.

Activity

  1. self-assigned this
    on Nov 15, 2020
  2. yakra commented on Nov 23, 2020

    @yakra
    ContributorAuthor

    Getting rid of these structures & their contents should free up some RAM, and maybe speed things up a tiny bit.

    By "a tiny bit", I mean "54.7% faster Creating per-traveler stats logs and augmenting data structure on BiggaTomato, C++, 4 threads."
    This calls for making a pretty graph. Haven't done one of those in a while.

    • (Did 53ca19d slow us down a tiny bit?) No!
      Not on lab2 at least. Didn't bother testing anywhere else.

      threads 3d56bd9 53ca19d diff
      1 30.98 30.6 -0.38
      2 15.24 15.02 -0.22
      3 10.29 10.18 -0.11
      4 7.74 7.64 -0.10
      5 6.29 6.24 -0.05
      6 5.29 5.24 -0.05
      7 4.67 4.59 -0.08
      8 4.1 4.09 -0.01
      9 3.83 3.76 -0.07
      10 3.62 3.56 -0.06
      11 3.43 3.35 -0.08
      12 3.22 3.2 -0.02
      13 3.09 3.05 -0.04
      14 2.94 2.89 -0.05
      15 2.81 2.78 -0.03
      16 2.7 2.68 -0.02
  3. yakra commented on Nov 23, 2020

    @yakra
    ContributorAuthor

    By "a tiny bit", I mean "54.7% faster Creating per-traveler stats logs and augmenting data structure on BiggaTomato, C++, 4 threads."

    Heh, nope. Small sample size (1) + not too tightly controlled testing conditions led to an inflated time for the old code.
    There is some improvement, but it's much smaller.

  4. yakra commented on Dec 10, 2020

    @yakra
    ContributorAuthor

    HighwayData @ aeaeb953348711a4265e31f66031af1d362485a8
    UserData @ f5458d401b8a7856efae631fe2b89d11d56bc4b2
    Saves about 11.3 MB C++ & 13.2 MB Python, plus whatever overhead may exist within the hash table structures themselves.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions