toruseo/UXsim

`record_log` takes too much time for medium - large scale simulation

Closed this issue · 2 comments

I also did some benchmarks using example_04en_automatic_network_generation.py (440 links, 12100 platoons, 1440 timesteps) and surprised that Vehicle.record_log takes long time (~50% of simulation) considering its simple task. I suspect too many use of append is the reason.

Since I won't be able to work on it for a while, I'll keep a record of it for later update.

with record_log
image

without record_log
image

Replacing the list to np.array did not improve the performance as expected.
I will consider to add options to lower the logging frequency or turn it off completely.

Added logging settings.

By setting World.vehicle_logging_timestep_interval=-1, the record_log is turned off, and the simulation time can be significantly reduced (~40% speed up) as shown in the above post.

The logging setting does not affect the internal simulation accuracy. Only the outputted trajectories are affected.

With World.vehicle_logging_timestep_interval=2, the simulation time can be reduced (~20% speed up), and we can obtain vehicle trajectory data with slightly less accuracy.
image

With World.vehicle_logging_timestep_interval=2:
image

With World.vehicle_logging_timestep_interval=1 (default, complete logging):
image