Skip to content

various minor improvements, take 2 - #507

Merged
jteresco merged 7 commits into
TravelMapping:masterfrom
yakra:threebase
Mar 22, 2022
Merged

various minor improvements, take 2#507
jteresco merged 7 commits into
TravelMapping:masterfrom
yakra:threebase

Conversation

@yakra

Copy link
Copy Markdown
Contributor

The first 5 commits are rebased from the last 5 in #505.

The last 2 commits are redos of the first 2 in #505.
There are several ways to more effectively use C++'s std::unordered_map class. Changes that would have conflicted with the first 2 commits of #505 are redone here; other items can be explored in the future.

  • 1672124 has the same diffs as d2cdcaa for 10 of 13 files, saving the other 3 for the next commit:
    • C++: mostly conceived as code-readability cleanup, but it ended up saving a little time on userlog generation, more noticeable on slower machines like lab3. Closesunordered_set::count yakra/DataProcessing#199.
    • Python: Minor cleanup that avoids having to create new list objects from objects that are already iterable/searchable.
  • dd274f2 redoes HighwaySystem.cpp, Route.cpp & sql_file.cpp.
    Both before & after #505, time was wasted by searching hash tables twice -- once to determine membership and again to get the value for a given key.
    Before, we at least got the result of std::unordered_map::find, even if only to use it as a temporary & then just discard it.
    Here, that result gets saved & used a 2nd time, avoiding that 2nd lookup.
    Plus, we get rid of that unnecessary membership test as done in c8b3c98, described with the code snippets in #505's OP. Not its own separate commit this time around.

yakra added 7 commits March 21, 2022 02:58
interactive rebase b54179c4e74277197b9d4efbcd47a01094f39179
This was introduced after the switch to clang, but only g++ reports it.
Doesn't need to be permanent.
same as d2cdcaa but without the changes to
HighwaySystem.cpp
Route.cpp
sql_file.cpp
...OR use unordered_map::count, only to search again
Also nix an unnecessary conditional when finding clinched system_region_mileage values
@jteresco

Copy link
Copy Markdown
Contributor

all good to go to production?

@yakra

Copy link
Copy Markdown
ContributorAuthor

Good to go.

@jteresco
jteresco merged commit de796fa into TravelMapping:masterMar 22, 2022
@yakra
yakra deleted the threebase branch March 22, 2022 20:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unordered_set::count python style floats: strcat -> strcpy

2 participants

@yakra@jteresco