assume-framework / assume

ASSUME - Agent-based Simulation for Studying and Understanding Market Evolution
https://assume.readthedocs.io
20 stars 5 forks source link

Speed up simulation #355

Closed nick-harder closed 1 month ago

nick-harder commented 1 month ago

-refactor the function itself to use vectorization -execute the funtion only once at the end of the simulation -paralellize the call for all agents to improve performance

suggestion by @maurerle

The speed up is as follows (tested on small example): current version - 24s vectorized calculate_generation_cost function - 16s execute calculation only at the end of the simulation - 8s

Using the small_learning_1 example: current version - 36s final tweaked version - 10s

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.97%. Comparing base (79d7c74) to head (78b74f1).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #355 +/- ## ========================================== + Coverage 77.94% 77.97% +0.03% ========================================== Files 43 43 Lines 5128 5135 +7 ========================================== + Hits 3997 4004 +7 Misses 1131 1131 ``` | [Flag](https://app.codecov.io/gh/assume-framework/assume/pull/355/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=assume-framework) | Coverage Δ | | |---|---|---| | [pytest](https://app.codecov.io/gh/assume-framework/assume/pull/355/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=assume-framework) | `77.97% <100.00%> (+0.03%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=assume-framework#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.