# Running agents.jl model with run!()

**URL:** <https://discourse.julialang.org/t/running-agents-jl-model-with-run/116477>\
**Category:** Modelling & Simulations\
**Tags:** agents, modelling, eventqueueabm\
**Created:** [July 1, 2024, 1:49pm UTC](https://discourse.julialang.org/t/running-agents-jl-model-with-run/116477 "2024-07-01T13:49:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [July 1, 2024, 1:49pm UTC](https://discourse.julialang.org/t/running-agents-jl-model-with-run/116477/1 "2024-07-01T13:49:31Z")

</div>

How can I avoid saving data after run in agent based model. I thought if we don’t give adata. It should automatically not save data and its not saving as in end dataframes are 0\*0 in size but its taking same amount of time after run to create that empty dataframe i think. I want to avoid this. So, things can run faster as I need to run model in loop. I don’t want it to do this in every iteration.

currently function looks like this

```julia
run!(model, step_point; showprogress = true)

```

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [July 1, 2024, 2:06pm UTC](https://discourse.julialang.org/t/running-agents-jl-model-with-run/116477/2 "2024-07-01T14:06:03Z")

</div>

if you don’t want to save data use `step!` instead of `run!`…?

---

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [July 2, 2024, 7:19am UTC](https://discourse.julialang.org/t/running-agents-jl-model-with-run/116477/3 "2024-07-02T07:19:57Z")

</div>

step!() is also taking similar amount of time. I feel my code need some optimisation. Will come back after some editing in my code. 🙂

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [July 2, 2024, 11:49am UTC](https://discourse.julialang.org/t/running-agents-jl-model-with-run/116477/4 "2024-07-02T11:49:04Z")

</div>

> [@Sahil\_Khan](#):
>
> step!() is also taking similar amount of time.

Well, yes, of course. For any realistic / reasonably complex ABM evolving it should take dramatically more time than just collecting the data. So `run!` and `step!` would take approximately the same time.

---

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [July 2, 2024, 11:59am UTC](https://discourse.julialang.org/t/running-agents-jl-model-with-run/116477/5 "2024-07-02T11:59:30Z")

</div>

Do you have any suggestions to improve performance? It will be helpful.

---

<div class="post-metadata">

**Author:** ![Tortar](https://avatars.discourse-cdn.com/v4/letter/t/6bbea6/32.png) [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Post date:** [July 2, 2024, 1:01pm UTC](https://discourse.julialang.org/t/running-agents-jl-model-with-run/116477/6 "2024-07-02T13:01:08Z")

</div>

it depends from the model in question. Without that, it is not possible to give very concrete suggestions. A possible venue is profiling your code, finding the bottlenecks and then report what you found. A simple advice could be to use `ensemblerun!` to run simulations in parallel.

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [July 2, 2024, 1:01pm UTC](https://discourse.julialang.org/t/running-agents-jl-model-with-run/116477/7 "2024-07-02T13:01:10Z")

</div>

see the last section in [Zero2Hero-JuliaWorkshop/1-JuliaIntro.ipynb at main · Datseris/Zero2Hero-JuliaWorkshop · GitHub](https://github.com/Datseris/Zero2Hero-JuliaWorkshop/blob/main/1-JuliaIntro.ipynb) for the basics. Then, benchmark every single function you have defined and optimize them one by one.
