agent-based simulation: performance issue: Python vs NetLogo & Repast

后端 未结 4 680
滥情空心
滥情空心 2021-02-03 10:17

I\'m replicating a small piece of Sugarscape agent simulation model in Python 3. I found the performance of my code is ~3 times slower than that of NetLogo. Is it likely the pro

4条回答
  •  长情又很酷
    2021-02-03 11:05

    This is an old question, but I suggest you look into using NumPy for speeding up your operations. Places where you use dicts and lists which are logically organized (1-, 2-, 3-, or N-dimensional grid) homogenous data object (all integers, or all floats, etc) will have less overhead when represented and accessed as Numpy arrays.

    http://numpy.org

提交回复
热议问题