mesa-frames: Vectorized Operations for Performance and Scalability
- Mentors
- Tom Pike, rht, Boyu Wang, Jan Kwakkel
- Organization
- Project Mesa
- Technologies
- python, cython, rust, pandas, Polars
- Topics
- performance, Dataframes, vectorization
mesa is renowned as the premier Python framework for agent-based modeling, combining powerful functionality with ease of use. However, the framework's reliance on standard Python objects to represent agents poses scalability challenges, hindering performance as the number of agents grows. This limitation renders the execution of even modestly sized models, comprising a few thousand agents, impractical. The community has long requested a more performant version of mesa. While a refactor using Cython could address performance issues, it would introduce significant complexity and require users to adapt their methods to Cython, compromising Python's simplicity. The mesa-frames initiative proposes leveraging vectorized operations on dataframes, utilizing libraries such as pandas and polars, to enhance performance and scalability. This approach benefits from the optimized, out-of-the-box operations these libraries provide and their intuitive, well-documented APIs, which simplify custom agent creation.