We are excited to announce the release of Ark.jl v0.1.0, an archetype-based entity component system (ECS) for Julia, ported from the Go ECS library Ark.
If you are unfamiliar with ECS, scroll down to learn why it is especially relevant for the Julia community.
Ark’s features
- Designed for performance and highly optimized.
- Well-documented, type-stable API.
- Blazing fast batch entity creation.
- No systems. Just queries. Use your own structure.
- Minimal dependencies, 100% test coverage.
Why ECS?
ECS was originally invented for game development, but there is an aspect that is probably more interesting for the Julia community:
ECS is exceptionally well suited for individual-based and agent-based models (IBMs/ABMS) and particle simulation models because it offer modularity, scalability, and performance, which aligns perfectly with the needs of simulating large numbers of autonomous agents.
An entity component system is a software architecture that separates data (components) from behavior (systems or queries), and organizes simulation elements (entities) as compositions of components. This design offers several key advantages for IBMs and ABMs:
- Modularity and Flexibility
- Each agent is an entity composed of components like position, velocity, health, or behavior traits.
- You can easily add, remove, or modify components at any time in a running simulation.
- This makes it simple to represent heterogeneous agents with varying attributes and behaviors.
- Scalability
- ECS is designed to handle millions of entities efficiently.
- Queries operate only on the required components, enabling high-performance, cache-friendly processing.
- Separation of Concerns
- Behavior logic is encapsulated in systems or queries, which operate on specific component types.
- This clean separation allows for easier debugging, testing, and extension of simulation logic.
- For example, a “movement system” might update all entities with Position and Velocity components, regardless of other traits.
ECS provides a high-performance, modular, and extensible foundation for agent-based simulations, making it ideal for modeling complex systems composed of many interacting, heterogeneous individuals. Its ability to cleanly separate data and behavior, scale to large populations, and support dynamic agent lifecycles makes it a natural fit for modern simulation needs.
Why Ark.jl?
Ark is primarily designed for performance and ease of use, with great care for good documentation. It allows domain experts to leverage Julia’s performance and modern hardware for their models, without needing deep software engineering expertise.
Ark provies a minimal core ECS implementation, avoiding rigid frameworks and giving you full control over your simulation architecture
Performance comparison
Finally, to demonstrate that Ark does not just offer great flexibility and modularity but also superb performance, here is a chart that compares iteration speed abainst the frequently use Array of Structs (AoS) approach where “model entities” are structs stored in a vector. Lines of different width represent entity size (in bytes or number of state variables). The figure shows that AoS slows down as entity count or size increases, while Ark maintains blazing speed across scales.
See the resp. documentation section for details.
We highly appreciate your feedback and contributions!
Special thanks to @Tortar for his substantial contributions to Ark, and for helping me to get started with Julia, particularly its compile-time features. His support was crucial for the progress we made and for the outstanding performance we achieved.
