Open yakra opened 1 year ago
All the hash table lookups make this pretty expensive.
TMBitset
should yield a big improvement. Edit: Yes, it did!
As of this writing, only the first 3 check boxes in the OP are checked. This takes priority over any other remaining items.miles += s->clinched_by(t) * s->length;
~for (HighwaySystem *h : HighwaySystem::syslist)
auto& region_mileages = system_region_mileages.at(h);
and put the whole "stats by system" routine in one big try
block.
Significantly slower. Verify that it's slower on FreeBSD too.auto it = system_region_mileages.find(h);
and then dereference, as stashed in 8ccb8b7
.
Still a bit slower though not as much. Verify slower on FreeBSD.system_region_mileages
an ordered map
Yes, some of these items are mutually exclusive. :)
if
up topif (r->last_update)
; this was checked prior to insertion https://github.com/yakra/DataProcessing/blob/29a6edfddc1132bfac95e0bbc59157f27fade551/siteupdate/cplusplus/classes/TravelerList/userlog.cpp#L122system_region_mileages
iterator as stashed in8ccb8b7
Route::readable_name()
ConnectedRoute::readable_name()
t_active_miles
system_region_mileage
Region
objects contiguously stored in aTMArray
sorted by code (see below)sysmbr
(AKAHighwaySystem::mileage_by_region
) contents; replace with an orderedmap
Doesn't do well on BiggaTomato, but how does it scale beyond 4 threads? A code string-based comparator may make the original setup too slow because!comp(a, b) && !comp(b, a)
. What if objects are sorted by code into aTMArray
and compared based on address?unordered_set
is to make a list ofpair
s and avoid thesysmbr.at(region)
lookup.map
:active_preview_mileage_by_region
Some options in decreasing expected efficiency...map
anywayRegion::allregions
; start bytry
ing to lookupt_active_prev_miles
travregions
as done now, but use the entirepair
(requires a new comparison function). This avoids anotheractive_preview_mileage_by_region
lookup.system_region_mileages
HighwaySystem::syslist
& checking membershipunordered_map
, as it's not iterated --sysmbr
is iterated instead in order to include zero-mileage regions; regional lookups are performed.updated_routes
Route::store_traveled_segments
: Setup 1 table, not 2.ConcAugThread
: Setup 1 table, not 2.Region::compute_stats
: Computation. Can do 1 lookup instead of 2, save a reference, update active/preview, update active-only as needed.TravelerList::userlog
: Lookups in "Overall by region" table. 1 lookup if using a sortedunordered_map
; 0 if using an orderedmap
.sqlfile1
: Avoid active-only lookup; just iterate.