[ANN] Ark.jl v0.3.0: Archetype-based ECS, now with entity relationships and batch operations

Ark.jl v0.3 is our biggest feature release yet. It introduces first‑class entity relationships, expands batch operations far beyond entity creation, and delivers substantial performance improvements.

Why ECS?

Skip this of you know it already!

Entity Component Systems (ECS) offer a clean, scalable way to build individual- and agent-based models by separating agent data from behavioral logic. Agents are simply collections of components, while systems define how those components interact, making simulations modular, extensible, and efficient even with millions of heterogeneous individuals.

Ark.jl brings this architecture to Julia with a lightweight, performance-focused implementation that empowers scientific modellers to design complex and performant simulations without the need for deep software engineering expertise.

Release highlights

Entity relationships

This release adds first‑class support for entity relationships, allowing you to express connections between entities directly using ECS primitives. While it is possible to express relations by storing entities inside components, the tight integration into the ECS provides several benefits. Most importantly, relationship can be queried now as efficiently as component queries. In addition, relationships become more ergonomic, more consistent, and safer to use.

For details, see the user manual’s chapter on Entity relationships.

Batch operations

Previous versions of Ark.jl already offered blazing‑fast batch entity creation. This release generalizes the concept to all operations that modify entities or their components. You can now remove all entities matching a filter, add components to all matching entities, and more, using a single batched call. These operations are typically at least an order of magnitude faster than performing the same changes individually.

For details, see the user manual’s chapter on Batch operations

Cached queries

Queries in archetype‑based ECS are already highly efficient, but this release introduces cached queries for even greater performance, especially in worlds with many archetypes. Instead of checking the components of all archetypes in the pre-selection (which is based on the most “rare” component in a query), cached queries maintain a list of all matching archetypes. This means matching checks are only needed when a new archetype is created, eliminating overhead during query iteration.

Performance improvements

Numerous optimizations to component operations and the archetype graph yield significant speedups. Component operations are now 1.5–2× faster, and entity creation is up to 3× faster than before.

More

For a full list of all changes, see the CHANGELOG.

As always, your feedback contributions are highly appreciated!

6 Likes

Looks very impressive, congratulations on the significant achievements since the initial release. Based on the description of how relationships work in the docs (1:1 between entities), it seems they are functions in the strict mathematical sense. This naturally leads me to think of Ark as being somewhat like an in-memory relational database, with the relations functioning like foreign keys. Is this how you think of Ark/ECS when using the system in designing “real” simulations/projects? Also, I am curious if you have seen GitHub - AlgebraicJulia/ACSets.jl: ACSets: Algebraic databases as in-memory data structures before which takes a categorical interpretation to the “sets and functions” approach to in memory relational databases.