-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The benchmark in the ReadMe seems to execute a too slow pure-python version #25
Comments
Yes, this seems much more what is expected. I'd like to see the speed-up with e.g. 500k though. This is what I see in Agents.jl julia> m = wealth_model(; numagents=500000);
julia> @time step!(m, 100);
1.785942 seconds (2 allocations: 3.815 MiB, 0.44% gc time)
I don't think so, at least if we compare single core dataframe vs. current approach of Agents. I think the fact that Agents.jl is 40x faster than Polars gives the opposite indication |
I can see that a vectorized+immutable Julia code could have more allocations in it (i.e. could be slightly slower), but what about the possibility of running a model on a GPU? |
yes, this would give a clear speed-up in my opinion, but I'm not sure by how much, probably it will depend on the operations. Also the fact that one is able to use multiple-cores on a CPU with a DataFrame-model is nice, but I'm unsure if a DataFrame is the best semantic, for once it is restrictive to how the model can be constructed, secondly vectorized+immutable as you say will probably have some perf penalty actually. |
@Tortar Thank you very much for digging deeper into the mesa benchmark! I personally just copied the examples from the mesa docs and didn't check what the issues were with the performance.
|
I stumbled across this repository, and while the approach seems interesting, actually the benchmark compares apple-to-oranges because the pure Python version is way too slow than what is expected. The running time seems also quadratic, which doesn't make a lot of sense to me because the money model seems linear in the number of agents. By digging into the source code I think that the culprit is at https://github.com/adamamer20/mesa-frames/blob/main/docs/scripts/readme_plot.py#L31 because
self.model.schedule.agents
creates a copy of the structure containing the agents, which makes the model much slower than what it should be, and explains also the quadratic behaviour.Indeed an Agents.jl version of the model is still like 40x faster than Polars:
Hope this helps you to find a better benchmark :-)
The text was updated successfully, but these errors were encountered: