Skip to content
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

Version where agents are structs instead of mutable structs #860

Closed
Tortar opened this issue Aug 27, 2023 · 1 comment
Closed

Version where agents are structs instead of mutable structs #860

Tortar opened this issue Aug 27, 2023 · 1 comment
Labels

Comments

@Tortar
Copy link
Member

Tortar commented Aug 27, 2023

In a blogpost by Bogumił Kamiński at https://bkamins.github.io/julialang/2020/10/16/gctime.html, he describes that using struct's instead of mutable struct's as agents can be beneficial even when fields are updated with Accessors.jl.

I'm not sure that this is true for any number and any type of fields but I think this could be nonetheless investigated.

If proved beneficial in at least some useful situations, this could be allowed along with the mutable version, but I think that integrating this version will require many updates to the codebase.

@Tortar Tortar added performance enhancement New feature or request hard labels Aug 27, 2023
@Tortar
Copy link
Member Author

Tortar commented Aug 30, 2023

Actually some experimentation tells that this doesn't give almost any edge even in elementary models where the number of fields is low (almost same time for Schelling and Flocking).

See https://github.com/Tortar/Agents.jl/tree/agents_structs for how structs can be used instead of mutables one, this requires hacky code (this still doesn't pass all tests) and it doesn't even change that much the performance, so I think it's a dead-end

@Tortar Tortar closed this as completed Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant