Skip to content

Conversation

@yakra
Copy link
Contributor

@yakra yakra commented Apr 23, 2022

Closes yakra#220. Removes an unused vestigial variable.
Closes #523.
Closes #522.


C++ Region management:

  • A step toward making siteupdate "Valgrind clean". Rather than manually create new Region objects on the heap and store pointers in a vector, Regions are emplaced in a list. (I'd prefer a vector, but can't because Region contains a std::mutex, which is immovable, making Regions immovable too. Went with this instead.)
    I don't have to manually delete anything, as the list destructor cleans the objects up at the end of the program when the list goes out of scope.
    Next up: TravelerLists.
  • In the process, changed the Region ctor to throw if the regions.csv line has the wrong # of fields. AIUI that's considered better practice than setting & checking a valid bit and deleting a fully constructed object, popping it from a container, etc. Cleaner code either way, and a tad less RAM.

throw if Region ctor fails
#220 remove vestigial std::string** update;
Region::allregions-> list
TravelMapping#523 redundant active/preview mileage
TravelMapping#522 redundant active/preview system counts
@yakra
Copy link
Contributor Author

yakra commented Apr 24, 2022

Going to take a closer look at this one. May reopen in a few... hours? Days?

@yakra yakra closed this Apr 24, 2022
@yakra
Copy link
Contributor Author

yakra commented Apr 26, 2022

Expected to re-open this after double-checking all my silly benchmarks.
Around the time I closed it, I found a couple things to optimize in TravelerList::userlog. One (counterintuitively) didn't pan out, but the other did. A decent performance boost under FreeBSD -- not as much as I'd hoped, but an improvement nonetheless.

Meanwhile, I've hit upon a way to get Region objects into contiguous memory, mutexes and everything. All I've got to do is:

  • Refactor the code that reads .wpt & .list files out into a new reusable function. (Done!)
  • Write a new .csv parsing routine. (Mostly done, as a separate program not integrated into siteupdate yet.)
  • Change the Region constructor to take fields as args instead of a whole line. (To do.)
  • Write a custom container class. (To do.)

Easy, right? 🤣 This will pay off when I get around to arranging HighwaySystems, Routes & HighwaySegments contiguously.

@yakra
Copy link
Contributor Author

yakra commented Apr 26, 2022

A decent performance boost under FreeBSD -- not as much as I'd hoped, but an improvement nonetheless.

Found a way to take it a step farther. Be a few hours before I can test on bsdlab (just started BiggaTomato) but the concept looks promising.

Sign up for free to 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.

redundant active/preview mileage redundant active/preview system counts vestigial std::string** update;

1 participant