mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 19:57:06 +01:00
aa9fc1b6f3
vehicle_table::update_steps_parallel() gives each group of vehicles an engine of Random() of its own, seeded from the run's engine and the group, so the draws are the same whichever thread takes the group. It built a std::mt19937 from a std::seed_seq for every group in every step: seed_seq::generate filling the 624 words of the state was 2.4% of the main thread and most of what the worker threads did (5263 of their non-waiting samples) on Tomaszewo, where most groups (parked wagons, cars) draw nothing. The group now gets a lazy_random_engine (utilities/lazyrandom.h) holding the two numbers, which Random() seeds the same way (std::seed_seq of the two) at the group's first draw. A group that draws gets the same numbers as before, one that doesn't skips the seeding. Ported from a local branch of 2026-11-28 (perf/parallel-group-random-engine-lazy-seed, on the layout before #531), with its tests: the lazy engine draws as one seeded up front from the same numbers, is seeded at the first draw only, and stands ahead of the thread's engine while it's set. 600 s in --test, seed 12345, one run each: Tomaszewo (raj40821) sim 151.5 s against 206.7 s the step before (-27%); L107 (linia_107_objazdy, binary terrain, gfxrenderer null) sim 20.5 s against 31.1 s. The physics logs (14 and 9) and the event logs are byte-identical to staging's, unit tests 1207/1207 with exact golden traces.