Skip to content

Mismatch in ForestFire implementation #60

Closed
@Corvince

Description

@Corvince

So I spent quite some time figuring out how to improve the performance of mesas ForestFire implementation. I couldn't believe such a large discrepancy for such a simple model. Most of the time is spent on attribute access and function calls. That is not a nice place to oprimize.

Then I looked more closely at the Agents.jl code and I think Agents.jl is almost cheating ;) Its a clever implementation, but it is very different from the other frameworks. Agents.jl uses dummy agents and a agent dummy. That is instead of using actual Agents on an actual Grid, it uses a matrix which holds the tree states. So instead of looking up tree attributes and calling a step function for each tree the logic is implemented only on this matrix.

Replicating the same approach in Python, I see a ~10x performance increase for Mesa.

Now I don't know which side should be changed - make agents.jl implementation more standard and explicit, but slower, or allow other frameworks to use the same tricks to make them faster. For Mesa, I could send in a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions