djgroen / flee

flee agent-based modelling code
BSD 3-Clause "New" or "Revised" License
8 stars 7 forks source link

flee speed enhancements #36

Closed marshHawk4 closed 2 years ago

marshHawk4 commented 2 years ago

Here are some minor changes to the flee code that increase the speed of runtime. We did some profiling on the code and found that one of the evolve functions was being called millions of times per fun and 98% of the model runtime was spent executing that function. With these minor changes we saw a 30% speed improvement on overall runtime. Happy to explain any of the changes and obviously take or leave any of the changes. I will comment on the code in the PR to explain the changes line by line for your reference.

djgroen commented 2 years ago

Thank you very much for these suggested changes. I will have to see how these match up with the Numba based improvements from PSNC (which I still have to merge in), but I think some of these changes will give a speedup independently of that. So I will merge them in now :).