Add benchmark for saved state performance
- Introduced `benchmark_saved_state.gd` to evaluate the performance of the saved state restoration process. - Implemented JSON integer restoration to handle large integers accurately. - Added command-line argument parsing for specifying the path to the diagnostic JSON file and optional delta seconds. - Conducted performance tests at different speeds and logged the elapsed time for six consecutive steps. - Created a new UID file for the benchmark script.
This commit is contained in:
@@ -75,5 +75,20 @@ func run() -> void:
|
||||
for batch in fast.state.batches.SN: total = E.add(total, batch.amount)
|
||||
check(E.eq(total, 10000), "Direct completions plus survivors conserve event count")
|
||||
dispose(fast)
|
||||
# Sparse explosions: thousands of time windows but very few actual events.
|
||||
# Exact interval edges and partial final windows exercise the jump boundary.
|
||||
for count in [1, 3, 17]:
|
||||
for year in [500, 1001]:
|
||||
fast = fixture(false)
|
||||
var legacy = fixture(true)
|
||||
fast.state.amount.RHG = count
|
||||
fast.state.batches.RHG = [{"amount": count, "start_year": E.of("0.25"), "end_year": E.of("1000.25")}]
|
||||
legacy.state = fast.state.duplicate(true)
|
||||
fast.evolution.evolve_batches(fast.state, year)
|
||||
legacy.evolution.evolve_batches(legacy.state, year)
|
||||
for field in fast.state:
|
||||
check(equivalent(fast.state[field], legacy.state[field]), "Sparse %s at %s: %s" % [count, year, field])
|
||||
dispose(fast)
|
||||
dispose(legacy)
|
||||
print(("Short-lived events: %d checks, %d failures" % [checks, failures]))
|
||||
quit((0 if E.eq(failures, 0) else 1))
|
||||
|
||||
Reference in New Issue
Block a user