You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for (std::pair<Region* const, double>& rm : system_region_mileages.at(h)) mi += rm.second;
return mi;
}
Change the name. Probably named in the early "translate from Python" days before I had a clear picture of what was going on. There's nothing regional about it. It's the total across all regions.
This has to look up the HighwaySystem twice. Once to make sure we're good to call the function, and again once the function is called. Instead, just do double t_system_overall = system_region_miles(h);, have the function catch the exception and keep on truckin', returning 0. Nope! 6.8310 -> 7.0672 s on BiggaTomato.
Maybe this could be a good improvement for FreeBSD? 😀 Try it anyway for giggles... Nope. 5% longer.
Eliminating the redundancy here is trickier. It's not as simple as calling the function and proceeding if result > 0, because the iterator is reused later. Maybe dereference it & use std::accumulate.
On that note, would std::accumulate magically be faster for item 1 above? Because accumulators LOL.
The text was updated successfully, but these errors were encountered:
Seems to make things slower, counterintuitively. Might get back to this later.
Rather than overload the + operator & #include <numeric> entirely (compilation time?) to use std:accumulate, here's what I came up with:
template <classmap>
doublemap_sum(const map& m)
{ double sum = 0;
for (auto& kv : m) sum += kv.second;
return sum;
}
Leaving this here for now while I delete the branch.
May come back to this once other options are in place, e.g. the chop3 branch's to_write & format_clinched_mi optimizations.
This function. This function right here.
DataProcessing/siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp
Lines 162 to 167 in cc9da66
DataProcessing/siteupdate/cplusplus/classes/TravelerList/userlog.cpp
Lines 42 to 44 in cc9da66
double t_system_overall = system_region_miles(h);
, have the function catch the exception and keep on truckin', returning 0.Nope! 6.8310 -> 7.0672 s on BiggaTomato.
Maybe this could be a good improvement for FreeBSD? 😀 Try it anyway for giggles... Nope. 5% longer.
DataProcessing/siteupdate/cplusplus/classes/HighwaySystem/HighwaySystem.cpp
Lines 167 to 172 in cc9da66
std::accumulate
magically be faster for item 1 above? Because accumulators LOL.The text was updated successfully, but these errors were encountered: