Link graph: Only use log2 of total cost for scaling when > 13

This is to fix unnecessary scaling for small networks
This commit is contained in:
Jonathan G Rennison
2020-09-03 17:21:16 +01:00
parent 6be6f7436f
commit d9ce75fd5d

View File

@@ -61,7 +61,8 @@ void LinkGraphSchedule::SpawnNext()
for (auto &it : this->running) {
total_cost += it->Graph().CalculateCostEstimate();
}
uint scaling = 1 + FindLastBit(total_cost);
uint log2_total_cost = FindLastBit(total_cost);
uint scaling = log2_total_cost > 13 ? log2_total_cost - 12 : 1;
uint64 cost_budget = total_cost / scaling;
uint64 used_budget = 0;
std::vector<LinkGraphJobGroup::JobInfo> jobs_to_execute;