Implement civilization flow mechanics and profiling for resource allocation
- Added `civilization_flow.gd` to manage continuous expected flows and resource allocation within civilizations. - Introduced `allocate_profiled` and `whole_quotas` functions in `quantity_math.gd` for precise stock allocation based on float shares. - Enhanced `credit` logic in `object_ledger.gd` to handle production remainders more effectively. - Updated `append_batch` in `object_batches.gd` to prevent batch creation for invalid IDs. - Introduced `ratio_approx` function in `exact.gd` for better handling of float profiles. - Added a benchmark script `benchmark_civilization_flows.gd` to evaluate the performance of civilization flow mechanics. - Refactored various functions to improve clarity and efficiency in handling resource flows and allocations.
This commit is contained in:
@@ -0,0 +1,345 @@
|
||||
{
|
||||
"cycles_per_run": 40,
|
||||
"delta_seconds": 0.2,
|
||||
"profile_enabled": true,
|
||||
"repeats": 2,
|
||||
"runs": [
|
||||
{
|
||||
"cycles": 40,
|
||||
"cycles_per_second": 1.6323701614814,
|
||||
"final_stellar_cohorts": 105,
|
||||
"game_years": "800000",
|
||||
"max_ms": 628.888,
|
||||
"mean_ms": 612.60615,
|
||||
"min_ms": 564.108,
|
||||
"model": "legacy",
|
||||
"p95_ms": 624.987,
|
||||
"peak_stellar_cohorts": 4560,
|
||||
"profile": {
|
||||
"assign_homes": [
|
||||
48558,
|
||||
160
|
||||
],
|
||||
"civilization_flow_capacity": [
|
||||
263456,
|
||||
40
|
||||
],
|
||||
"civilization_flow_colonies": [
|
||||
2192836,
|
||||
40
|
||||
],
|
||||
"civilization_flow_finish": [
|
||||
401558,
|
||||
40
|
||||
],
|
||||
"civilization_flow_ledger": [
|
||||
4523753,
|
||||
40
|
||||
],
|
||||
"civilization_flow_plan": [
|
||||
4491368,
|
||||
40
|
||||
],
|
||||
"civilization_operator_build": [
|
||||
128185,
|
||||
40
|
||||
],
|
||||
"civilization_operator_solve": [
|
||||
1314272,
|
||||
1720
|
||||
],
|
||||
"enforce_capacity": [
|
||||
755412,
|
||||
160
|
||||
],
|
||||
"generation_products": [
|
||||
621550,
|
||||
80
|
||||
],
|
||||
"generation_withdrawal": [
|
||||
2524452,
|
||||
120
|
||||
],
|
||||
"generations": [
|
||||
8393123,
|
||||
40
|
||||
],
|
||||
"initialize": [
|
||||
293736,
|
||||
40
|
||||
],
|
||||
"newborn_batches": [
|
||||
1166060,
|
||||
19424
|
||||
],
|
||||
"physical_amounts_build": [
|
||||
1707597,
|
||||
675
|
||||
],
|
||||
"production": [
|
||||
2026863,
|
||||
40
|
||||
],
|
||||
"trends": [
|
||||
716666,
|
||||
40
|
||||
]
|
||||
},
|
||||
"repeat": 1,
|
||||
"throughput": 0.32647403229628
|
||||
},
|
||||
{
|
||||
"cycles": 40,
|
||||
"cycles_per_second": 1.88577938012452,
|
||||
"final_stellar_cohorts": 99,
|
||||
"game_years": "800000",
|
||||
"max_ms": 564.379,
|
||||
"mean_ms": 530.284725,
|
||||
"min_ms": 448.092,
|
||||
"model": "cycle",
|
||||
"p95_ms": 560.287,
|
||||
"peak_stellar_cohorts": 607,
|
||||
"profile": {
|
||||
"assign_homes": [
|
||||
39924,
|
||||
132
|
||||
],
|
||||
"civilization_flow_capacity": [
|
||||
265954,
|
||||
40
|
||||
],
|
||||
"civilization_flow_colonies": [
|
||||
2204837,
|
||||
40
|
||||
],
|
||||
"civilization_flow_finish": [
|
||||
404568,
|
||||
40
|
||||
],
|
||||
"civilization_flow_ledger": [
|
||||
4540902,
|
||||
40
|
||||
],
|
||||
"civilization_flow_plan": [
|
||||
4517593,
|
||||
40
|
||||
],
|
||||
"civilization_operator_build": [
|
||||
128322,
|
||||
40
|
||||
],
|
||||
"civilization_operator_solve": [
|
||||
1324328,
|
||||
1720
|
||||
],
|
||||
"enforce_capacity": [
|
||||
672871,
|
||||
132
|
||||
],
|
||||
"generation_products": [
|
||||
184761,
|
||||
52
|
||||
],
|
||||
"generation_withdrawal": [
|
||||
2150050,
|
||||
92
|
||||
],
|
||||
"generations": [
|
||||
5519639,
|
||||
40
|
||||
],
|
||||
"initialize": [
|
||||
295834,
|
||||
40
|
||||
],
|
||||
"newborn_batches": [
|
||||
118202,
|
||||
3115
|
||||
],
|
||||
"physical_amounts_build": [
|
||||
1594387,
|
||||
612
|
||||
],
|
||||
"production": [
|
||||
1526313,
|
||||
40
|
||||
],
|
||||
"trends": [
|
||||
723713,
|
||||
40
|
||||
]
|
||||
},
|
||||
"repeat": 1,
|
||||
"throughput": 0.377155876024903
|
||||
},
|
||||
{
|
||||
"cycles": 40,
|
||||
"cycles_per_second": 1.87765994001252,
|
||||
"final_stellar_cohorts": 99,
|
||||
"game_years": "800000",
|
||||
"max_ms": 566.428,
|
||||
"mean_ms": 532.5778,
|
||||
"min_ms": 456.191,
|
||||
"model": "cycle",
|
||||
"p95_ms": 565.345,
|
||||
"peak_stellar_cohorts": 607,
|
||||
"profile": {
|
||||
"assign_homes": [
|
||||
40238,
|
||||
132
|
||||
],
|
||||
"civilization_flow_capacity": [
|
||||
264957,
|
||||
40
|
||||
],
|
||||
"civilization_flow_colonies": [
|
||||
2218466,
|
||||
40
|
||||
],
|
||||
"civilization_flow_finish": [
|
||||
405624,
|
||||
40
|
||||
],
|
||||
"civilization_flow_ledger": [
|
||||
4564735,
|
||||
40
|
||||
],
|
||||
"civilization_flow_plan": [
|
||||
4543992,
|
||||
40
|
||||
],
|
||||
"civilization_operator_build": [
|
||||
127427,
|
||||
40
|
||||
],
|
||||
"civilization_operator_solve": [
|
||||
1338172,
|
||||
1720
|
||||
],
|
||||
"enforce_capacity": [
|
||||
672773,
|
||||
132
|
||||
],
|
||||
"generation_products": [
|
||||
185633,
|
||||
52
|
||||
],
|
||||
"generation_withdrawal": [
|
||||
2159985,
|
||||
92
|
||||
],
|
||||
"generations": [
|
||||
5547513,
|
||||
40
|
||||
],
|
||||
"initialize": [
|
||||
297516,
|
||||
40
|
||||
],
|
||||
"newborn_batches": [
|
||||
119187,
|
||||
3115
|
||||
],
|
||||
"physical_amounts_build": [
|
||||
1590461,
|
||||
612
|
||||
],
|
||||
"production": [
|
||||
1516716,
|
||||
40
|
||||
],
|
||||
"trends": [
|
||||
731042,
|
||||
40
|
||||
]
|
||||
},
|
||||
"repeat": 2,
|
||||
"throughput": 0.375531988002504
|
||||
},
|
||||
{
|
||||
"cycles": 40,
|
||||
"cycles_per_second": 1.60095961519335,
|
||||
"final_stellar_cohorts": 105,
|
||||
"game_years": "800000",
|
||||
"max_ms": 660.704,
|
||||
"mean_ms": 624.625375,
|
||||
"min_ms": 562.732,
|
||||
"model": "legacy",
|
||||
"p95_ms": 638.671,
|
||||
"peak_stellar_cohorts": 4560,
|
||||
"profile": {
|
||||
"assign_homes": [
|
||||
49183,
|
||||
160
|
||||
],
|
||||
"civilization_flow_capacity": [
|
||||
268901,
|
||||
40
|
||||
],
|
||||
"civilization_flow_colonies": [
|
||||
2229856,
|
||||
40
|
||||
],
|
||||
"civilization_flow_finish": [
|
||||
406135,
|
||||
40
|
||||
],
|
||||
"civilization_flow_ledger": [
|
||||
4623708,
|
||||
40
|
||||
],
|
||||
"civilization_flow_plan": [
|
||||
4578330,
|
||||
40
|
||||
],
|
||||
"civilization_operator_build": [
|
||||
130249,
|
||||
40
|
||||
],
|
||||
"civilization_operator_solve": [
|
||||
1340466,
|
||||
1720
|
||||
],
|
||||
"enforce_capacity": [
|
||||
765788,
|
||||
160
|
||||
],
|
||||
"generation_products": [
|
||||
635386,
|
||||
80
|
||||
],
|
||||
"generation_withdrawal": [
|
||||
2573324,
|
||||
120
|
||||
],
|
||||
"generations": [
|
||||
8560126,
|
||||
40
|
||||
],
|
||||
"initialize": [
|
||||
297396,
|
||||
40
|
||||
],
|
||||
"newborn_batches": [
|
||||
1191081,
|
||||
19424
|
||||
],
|
||||
"physical_amounts_build": [
|
||||
1738195,
|
||||
675
|
||||
],
|
||||
"production": [
|
||||
2069255,
|
||||
40
|
||||
],
|
||||
"trends": [
|
||||
735591,
|
||||
40
|
||||
]
|
||||
},
|
||||
"repeat": 2,
|
||||
"throughput": 0.320191923038669
|
||||
}
|
||||
],
|
||||
"speed": 6
|
||||
}
|
||||
Reference in New Issue
Block a user