<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>F. Foglia);
cspagnuolo@unisa.it (C. Spagnuolo); vitsca@unisa.it (V. Scarano)</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>The impact of ECS logic on parallel performance in agent-based model simulations</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Antonio Ambrosio</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Daniele De Vinco</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Francesco Foglia</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Carmine Spagnuolo</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Vittorio Scarano</string-name>
        </contrib>
      </contrib-group>
      <pub-date>
        <year>2025</year>
      </pub-date>
      <volume>000</volume>
      <fpage>0</fpage>
      <lpage>0003</lpage>
      <abstract>
        <p>Agent-Based Modeling (ABM) is a powerful technique for simulating complex systems through the interaction of individual agents, each following simple rules. However, the computational eficiency of ABM, especially in large-scale simulations, is often limited by the sequential nature of traditional methodologies. This paper presents an innovative approach to ABM using the Entity-Component-System (ECS) methodology, which adopts a data-oriented paradigm that prioritizes the model's logic over the complexity of the simulation. ECS, a software architecture commonly used in game development, decouples data (components) from behavior (systems), allowing for more granular control of each element. By applying ECS to ABM, the system's agents are treated as entities, with their characteristics stored as components and behaviors encapsulated in systems. This modular design enables the distribution of computational tasks across multiple processors or threads, enabling fine-grained parallelism and reducing bottlenecks commonly arising in traditional ABM frameworks. Our experiments on realworld use cases demonstrate that the ECS-based ABM ofers significantly higher parallel eficiency, particularly in scenarios with a large number of agents and complex interactions, while preserving ease of use and a reliable underlying structure.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Agent-based modelling</kwd>
        <kwd>Parallel</kwd>
        <kwd>Simulation</kwd>
        <kwd>ECS</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Agent-based models (ABMs) have been proven efective in modeling real-world phenomena [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. This
bottom-up approach breaks down complex problems into smaller individuals called agents, and from
their interactions, the emergent behavior of the system is constructed [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. This method enables modelers
to explore a wide range of phenomena, such as economic models, weather forecasting, social networks,
evolutionary systems, and more [
        <xref ref-type="bibr" rid="ref3 ref4">3, 4</xref>
        ]. Using such a model allows the modeler to concentrate on the
system’s logic rather than its inherent complexity. Additionally, the complexity of ABM is transferred
from the model to the simulation architecture, which must handle diverse information and features. As
a result, it is typically impractical for a single individual to develop a comprehensive structure capable
of managing various types of agents and handling significant computational demands. Therefore, it is
common practice not to develop these models from scratch, but rather to utilize established and reliable
toolkits or frameworks [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Among these, agent-based modeling (ABM) engines like MASON, NetLogo,
and Repast are popular choices [
        <xref ref-type="bibr" rid="ref6 ref7 ref8">6, 7, 8</xref>
        ]. However, these engines share similar architectures and concepts,
which also means they inherit comparable limitations. For example, ABM simulations can be very
time-consuming because of their particularly high computational load. Additionally, the execution
time can significantly impact the final result, as some simulations achieve greater accuracy over time.
As a consequence, a focus should be placed on how these toolkits can be made as eficient as possible.
Additionally, these simulations have proven efective in "what-if" scenarios, where modelers aim to
explore a vast configuration space to replicate real-world phenomena. Consequently, the eficiency of
each simulation is crucial to explore this space within a reasonable time frame.
      </p>
      <p>
        In this work, we present an experimentation of ECS (Entity-Component-System) within krABMaga [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ],
a discrete-event simulation engine written in Rust capable of handling large simulations. This modular
framework enables modelers to easily implement models across diferent computational paradigms
(sequential, parallel, and distributed) with minimal efort required to switch between them. Moreover,
the krABMaga engine includes a visualization module built using Bevy, a game engine entirely developed
in Rust. Our proposed variant introduces an architecture where the core module has been restructured
around Bevy’s ECS model. The ECS architecture is a software design pattern widely used in game
development. Still, its flexibility and eficiency make it suitable for other computational domains like
simulations, including ABM. ECS separates the data (components) from the logic (systems) and organizes
them into entities, providing a highly modular and scalable framework for managing complex, dynamic
systems. An example of this architecture is shown in Figure 1.
      </p>
      <p>In agent-based modeling, agents can be represented as entities, with attributes such as wealth
or location defined as components. This analogy creates a natural link between ABM and the ECS
model, merging the benefits of both worlds, such as performance and usability, without increasing
complexity. Breaking down agents into individual components in ECS allows for better reusability and
ifne-tuned control over each simulation aspect. Systems, such as a movement system, may update agent
positions based on velocity components. ECS systems can also process entities in batches, enabling
high-performance execution by applying the same operations to multiple entities within a system.</p>
      <p>
        In ABM, large scale refers not only to simulations with many agents but also to the challenge of
managing the complexity of such simulations [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. Parry identified several methods to address the
challenges of implementing large-scale ABM. These techniques range from adjusting the level of agent
complexity, investing in new hardware, restructuring the software, or rewriting the program using a
parallel approach. Each method has pros and cons, but the parallel approach appears to be the most
eficient. However, developing new parallel algorithms and accurately defining the communication
layer can be challenging and time-consuming.
      </p>
      <p>To the best of our knowledge, the ECS model has never been employed to implement an ABM engine.
We have experimented with ECS to develop the visualization module, but it was not involved in the
management of the entire simulation. For this reason, we aim to fill the gap in the literature investigating
the feasibility of applying such a model in the context of ABM. Therefore, the research questions we
aim to address in this paper are:
• Is the ECS architecture feasible for use in agent-based modeling? Does it increase or decrease the
dificulty of the development cycle?
• Does the ECS architecture show an increase in performance?
• How does the parallelized ECS model perform in agent-based simulations under high loads?
Furthermore, we empirically evaluate the ECS model’s parallelization, examining its scalability and
performance under high computational loads, testing the application on two well-known agent-based
models.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Background</title>
      <p>
        ABM. Over the past decade, the research community has developed numerous software frameworks
and tools to support the creation of agent-based modeling simulations. These tools are often available as
software libraries for various programming languages and may be optimized for specific computational
platforms or tailored to particular application domains [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. Most ABM simulation engines are designed
to ensure ease of use, optimize performance, or strike a balance between the two, depending on the
modeler’s requirements and the computational demands of the simulation model [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. It is important
to note that high-performance computing solutions are not just suited for large-scale or fine-grained
ABMs. They are also highly beneficial for small-scale ABMs that require substantial computational
resources [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. This is particularly relevant when small-scale models go through complex phases such
as calibration, verification, validation, sensitivity analysis, and experimentation. Additionally, many
simulations require numerous Monte Carlo repetitions, a type of simulation that relies on repeated
random sampling and statistical analysis to compute results. This approach is particularly useful for
experiments where the specific outcome is unpredictable in advance, as it allows for statistical insights
into a range of possible outcomes. By simulating scenarios with varying inputs, Monte Carlo methods
provide a robust framework for understanding probabilistic systems and are widely used in fields where
uncertainty plays a key role [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. Monte Carlo experiments can significantly benefit from horizontal
scaling. In such cases, high-performance computing resources can accelerate these massive Monte
Carlo runs [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]. In situations where vertical scaling is necessary, reducing the model’s execution time
becomes the only viable way to speed up the simulation process. As a result, eficiently managing
computationally intensive models—whether large or small—and conducting long-running, reliable
simulations is becoming increasingly critical for the field.
      </p>
      <p>
        Parallel computation. One efective technique to boost computational performance is to redesign the
architecture or model to support parallel optimization. Parallel computation is a powerful method in
which multiple calculations or processes are executed simultaneously across multiple processing units,
enabling complex problems to be solved more quickly than would be feasible with a single processor [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ].
This approach is based on the idea that many problems can be decomposed into smaller, independent
tasks that can run concurrently, allowing processors to collaborate in parallel to reach a solution. This
structure aligns well with the design of ABMs, which often benefit from parallel processing due to
the independent nature of agents’ actions and interactions. Moreover, the significance of parallel
computation has increased with the advent of multi-core processors and distributed computing systems,
particularly in fields that require substantial computational power, such as scientific simulations, data
analysis, and machine learning [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]. The capacity to handle more complex calculations eficiently has
made parallel computation an invaluable asset in a wide array of applications, from research to industry.
ECS. Implementing complex applications, such as ABMs, using traditional object-oriented programming
(OOP) architectures can often be challenging. Large class hierarchies, complex inheritance structures,
and the addition of new entity types can quickly lead to a large codebase. As a result, code flexibility
and reusability decrease, and performance can sufer. The encapsulation of data inherent to OOP
can also present challenges when aiming for high performance, particularly when dealing with large
numbers of entities. This encapsulation can make it more dificult to optimize memory usage and
data access patterns, both of which are essential for eficiency in large-scale applications [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ]. ECS
architecture can provide a complementary framework for organizing ABMs in a parallel context. The
clear distinction between logic and data is the core of the ECS architecture. This separation is achieved
by defining an object as an entity, uniquely identified and associated with multiple dynamic components
representing its data. This data is stored in memory to optimize cache usage and can be added, removed,
or iterated during program execution. Iteration is facilitated through systems, which allow the selection
of the specific data type to process for each entity. More specifically, systems operate on a set of
components known as archetypes. This approach enables the development of reusable, extendable, and
high-performance code, focusing only on the relevant data for a particular operation while maximizing
cache locality. Currently, several frameworks ofer eficient implementations of this architecture. Unity
and Unreal Engine, two popular game development engines, provide an ECS framework, Unity DOTS 1
and Apparatus 2. Other notable examples are entt 3 and Flecs 4. Although our choice has fallen on Bevy
ECS 5 to speed up the development process, there are four other major ECS implementations for the
Rust programming language (Specs 6, Legion 7, hecs 8, Shipyard 9). Bevy ECS is the ECS implementation
used in the Bevy Engine, a game development engine. Bevy ECS was developed to provide a simpler
alternative to other implementations, which often required advanced Rust concepts like lifetimes,
macros, or the builder pattern to construct ECS elements. One of the most intriguing features ofered by
Bevy is the ability to run applications directly in the browser with minimal performance loss. The web
platform leverages this capability to enable the execution and visualization of various simulations created
with krABMaga directly in the browser. This is made possible by integrating WebAssembly(WASM)
and WebGL(Web Graphics Library).
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Methodology</title>
      <p>In most agent-based modeling (ABM) toolkits, simulations usually follow a structured workflow divided
into three phases: pre-step, step, and post-step. Each iteration corresponds to a discrete time step, with
the step phase being essential and the others optional. The pre-step phase prepares the simulation
by organizing agents, allocating resources, and scheduling entities. The step phase is the core of the
simulation, executing the model’s main logic and handling agent behaviors and interactions. In the
post-step phase, the toolkit finalizes tasks by updating shared data, releasing unused resources, and
possibly performing data logging or analysis. This phased structure ensures eficient computation and
supports scalability for complex models with many agents.</p>
      <p>Specifically in krABMaga, the simulation progresses in steps using double bufering, meaning that
agents scheduled at step  cannot see any changes happening in the current step unless the modeler
forces a read on the specific structure of the bufering. Instead, they only see the state of other agents,
ifelds, and the simulation as they were at step  − 1. This mechanism’s clear separation of read and
write structures allows the engine to perform better on several tasks.</p>
      <p>
        In sequential execution, as the paradigm suggests, each stage of the process must wait for the previous
one to complete, even when it is unnecessary. Moreover, the simulation’s logic, encapsulated in the step
phase, can be executed independently for each agent. This naturally leads to a scenario where parallel
execution is both possible and highly beneficial. However, the original architecture of krABMaga,
influenced by inherent features of the Rust programming language, limits the ease of writing parallel
code due to its strict concepts of ownership and borrowing [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]. These constraints make it challenging
to implement parallel execution on the original architecture without significant restructuring.
      </p>
      <p>By contrast, modeling an agent-based model using an ECS architecture ofers a more suitable approach.
The main building blocks of an ECS are described as follows:
• Entities: An entity is essentially a unique identifier that serves as a container for various
components. Unlike objects in object-oriented programming, entities do not hold data or logic
themselves; they are purely identifiers. This makes entities lightweight and flexible.
1https://unity.com/dots
2https://www.unrealengine.com/marketplace/en-US/product/apparatus
3https://github.com/skypjack/entt
4https://github.com/SanderMertens/flecs
5https://github.com/bevyengine
6https://github.com/amethyst/specs
7https://github.com/amethyst/legion
8https://github.com/Ralith/hecs
9https://github.com/leudz/shipyard
• Components: Components are the pieces of data that define the characteristics or state of an entity.</p>
      <p>Each component typically holds a single aspect of data, such as position, velocity, or health.
• Systems: Systems contain the logic that operates on entities by modifying their components. They
are responsible for processing data in a component-centric manner.</p>
      <p>As mentioned earlier, ECS decouples data from behavior, facilitating the independent processing of
agents and making the transition to parallel code much more straightforward. This decoupling enables
better scalability and performance, particularly in large-scale simulations where parallel execution can
significantly reduce computational time. The ECS design inherently aligns with parallelism by enabling
simultaneous updates to entities without direct dependencies, making it an ideal solution for ABM
simulations that require high performance.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Evaluation Strategy</title>
      <p>The original version of KrABMaga leverages Bevy as its visualization module. Bevy is a straightforward,
data-driven game engine that lets users take advantage of the ECS architecture within the Rust ecosystem.
By default, Bevy supports highly parallel and cache-eficient programming. It ofers various features
and libraries for making queries, managing global and local resources, and implementing a lock-free
parallel scheduler.</p>
      <p>
        To assess our framework, we adapted two widely used examples from the ABM field: the Boids
simulation [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ], which mimics bird flocking behavior, and WolfSheepGrass [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ], a predator-prey model
that balances the interactions among three diferent populations, following Lotka-Volterra equations [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ].
These examples are valuable for evaluating the engine’s performance with single and multiple agent
types. To better describe our eforts and improvements, we will provide insights into the development
of the WolfSheepGrass implementation.
      </p>
      <p>First experiment. The initial implementation forcefully imposed parallelism on agent data structures
using mutable queries for sheep and wolves. When a wolf detects and eats a sheep, it gains energy; the
sheep must be removed, and the field updated to prevent other wolves from eating the same dead sheep.
Parallel implementation proved challenging due to the overhead of mutually exclusive field updates.</p>
      <p>This experiment showed that the focus should be on tracking sheep deaths and wolf energy gains per
location. To overcome this, we implemented atomic counters tracking wolves per grid cell. The system
processed sheep and grid in parallel, despawning appropriate sheep from each cell. Using wolf counts,
sheep fields, and wolf locations, we calculated energy gains by computing the minimum between sheep
and wolves per cell. This approach failed to improve performance because atomic operations introduced
locks during execution, creating bottlenecks that did not resolve field update issues.
Second experiment. The constraint that agents only interact within the same location was intended to
isolate potential conflicts. Wolves kill sheep and gain energy in the same grid cell. The challenge was
modifying wolves’ energy values during parallel execution, as Rust’s mutable objects cannot be shared
across threads. To address this, we used locks, ensuring only one thread could access an agent’s data at
a time. Instead of locking entire query objects, locks were applied directly to agents’ data, maintaining
eficient parallel execution while satisfying Rust’s memory safety requirements.</p>
      <p>Third experiment. The previous experiment did not fix the grid’s weak performance. Placing a lock
on the entire grid would cause race conditions among agents. However, each agent only creates race
conditions within its specific grid bag. Since we modify only the bag corresponding to the agent’s
location rather than the entire grid, the solution is to place locks on individual bags. This allows locking
only the required bag, reducing thread contention and improving parallel eficiency.
Fourth experiment. Despite fixing some grid problems, agent management became a bottleneck.
Spawning and despawning agents when they die or are born influenced engine performance. To optimize
agent lifecycles, we replaced the spawning system with Bevy’s parallel system, which creates a bufer
for the spawn_batch function. This allows instantiating all agents in a single call using an iterator
containing initialization data, streamlining the process.</p>
      <p>Current experiment. Previous attempts at the new implementation failed to improve performance across
all critical sections of the architecture simultaneously. Each attempt addressed individual issues, but
none provided a complete solution. The main bottlenecks were sequential field updates, agent spawning
and despawning, and certain Bevy command executions. In the current implementation, which we
refer to as the cemetery system, we aim to address all these issues concurrently, resulting in a more
comprehensive and eficient approach. The cemetery system is a memory management technique
designed to optimize memory reuse in simulations, especially when agents frequently die or need
respawning. In traditional approaches, when an agent dies or is removed from the simulation, the
associated memory is typically deallocated and must be reallocated later when a new agent spawns.
Since this allocation-deallocation cycle repeats each iteration, it introduces performance overhead,
especially in large-scale simulations where many agents are created and destroyed. In contrast, the
cemetery system avoids this overhead by maintaining a pool of freed but unallocated memory locations
when agents die. Instead of removing the memory entirely, the system places the memory of dead
agents into a designated region called the cemetery. This region serves as a holding area, preserving
space for future use. When new agents need to be created, the system reuses these empty cemetery
spaces, assigning them to agents that require spawning. By reusing already-allocated memory, the
cemetery system reduces frequent memory allocations, which are expensive in both time and system
resources. The cemetery system operates within a single iteration window. Agent memory need not
persist across the entire simulation, only during the current step. This approach enhances performance
more granularly, avoiding overhead associated with Bevy’s internal functions, such as querying and
reordering, which occur when managing entities.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Empirical Results</title>
      <p>To answer our research questions, we have tested Boids and WolfSheepGrass with the last architecture
shown in the previous section (ECS with a cemetery system). The code for each attempt and benchmark
is available as a GitHub repository 10. As a baseline, we measured the execution times of these models
using the original sequential krABMaga implementation. Starting from 32000 agents, we have doubled
this number to 2048000. The field size was selected to maintain an agent density of approximately 10%.
Moreover, each configuration is tested on diferent numbers of threads, starting from 1 to 20, with an
average elapsed time of 5 runs. The machine is configured as follows:
• OS: Ubuntu 24.04.1 LTS x86_64
• CPU: Intel i9-14900KF @ 5.800GH (24 Cores, of which Performance-cores 8, Eficient-cores 16)
• Memory: 64 GB
10https://github.com/Tonaion02/KrABMagaPersonalDev
the table includes a "step" column, which highlights the performance improvements during the most
computationally intensive tasks.</p>
      <p>As discussed in the methodology section, the primary bottleneck in the simulation arises from
updating the internal structure of the system. Up to 8 threads, there is a noticeable and consistent
increase in speedup, reflecting eficient parallelization. However, beyond this point, the performance
reaches a plateau. This plateau is due to the communication and synchronization overhead between
threads, which becomes more pronounced as the number of threads increases. At this stage, the benefits
of additional parallelism are ofset by the cost of managing inter-thread dependencies and coordination.</p>
      <p>Figure 2a illustrates a snapshot of the initial implementation of the ECS methodology, as described in
the previous section. The computation is divided into distinct phases, each occupying separate slots
within a single iteration of the model’s execution. Notably, some of these phases overlap, meaning they
must be executed sequentially, which extends the overall time required to complete each iteration. This
segmentation reduces the potential for parallelism and introduces ineficiencies, as certain tasks must
wait for the completion of others before proceeding.</p>
      <p>Figure 2b shows the execution time of the WSG model in its final iteration, incorporating the
cemetery system. In this implementation, entities are allocated at the start of the simulation. When an
agent dies, instead of being deallocated, it leaves behind an empty space in the "cemetery," which can
be reused for future agents in subsequent steps. This approach eliminates the overhead of dynamic
memory deallocation and reallocation during runtime. As a result, the previously time-consuming
0,52
0,28
0,15
0,08
0,07
0,07
4,51
2,27
1,16
0,66
0,44
0,38</p>
      <p>1
1,84
3,42
5,97
6,85
7,02</p>
      <p>1
1,98
3,87
6,78
10,24
11,70</p>
      <p>Step
Count Wolves</p>
      <p>Update Sheep
Apply Commands</p>
      <p>Grass Grow
Update Fields</p>
      <p>Step
Cemetery System
0.8
(a) This snapshot captures a single iteration of the first (b) This snapshot shows a single iteration from the final
implementation of ECS architecture. implementation of the ECS architecture.
(a) Stacked values of the components in the last experi-(b) Total execution times of each simulation size varying
ment. the number of threads.
"apply commands" phase, which handled entity management, is now optimized and no longer consumes
significant processing time. This improvement allows the system to more efectively parallelize
operations, enabling simultaneous execution of diferent components of the simulation. The cemetery system
thus contributes to a more eficient overall workflow, reducing bottlenecks and improving parallel
performance.</p>
      <p>Figure 3b shows the total execution time of the final implementation of the WSG model. The cemetery
system is stable, reaching a constant value across diferent thread counts, showing that it no longer
significantly influences the overall performance. The computation time for each step scales well with
the increasing number of threads, although performance plateaus after reaching 8 threads. This suggests
that the simulation benefits from parallelization up to a certain point, beyond which the overhead of
synchronization and communication between threads becomes a bottleneck.</p>
      <p>While the update fields still occupy a portion of the total execution time, the introduction of parallelism
allows various field management tasks to be handled concurrently. As a result, the overall impact of the
ifeld on the simulation’s total runtime is reduced.</p>
      <p>Additionally, Figure 3b highlights the performance of the WSG model across various simulation sizes
and thread counts. Notably, the performance plateau discussed earlier is not influenced by the size of
the field or the number of agents. Instead, it is a direct consequence of the inherent limitations of the
ECS architecture. This suggests that while the ECS framework provides certain advantages, its current
implementation reaches a point where additional parallelism no longer yields significant performance
improvements. Given this observation, future research should focus on exploring alternative methods
for managing the diferent phases or structures of the simulation. By optimizing the organization and
execution of the simulation’s various tasks, it may be possible to overcome the current performance
bottleneck and achieve further gains in eficiency.
5.1. Limitations
However, factors such as load balancing, synchronization costs, and the nature of agent interactions
influence the level of parallel eficiency. In tightly coupled simulations, where agent interactions are
frequent and complex, the overhead from synchronization ofsets the gains from parallelization. This is
highlighted by the simulation’s plateau of performance, as shown in the previous chapter.</p>
      <p>The framework was designed as a versatile tool to support a wide range of applications. However,
this broad compatibility may result in certain components being less eficient due to the need for diverse
use cases. To optimize performance and properly evaluate the benefits of this approach, additional
workloads should be tested, and a code profiling should be conducted to fix issues such as caching or to
evaluate the impact of tightly vs loosely coupled agents.</p>
      <p>It is crucial to recognize that redesigning an engine for parallel architecture presents significant
challenges, and the associated development costs must be carefully weighed when determining the
feasibility of this solution.</p>
    </sec>
    <sec id="sec-6">
      <title>6. Conclusion and Future Directions</title>
      <p>This paper explored the parallel eficiency of an ABM engine built entirely on the ECS logic. The
ECS architecture enables a clear separation of its elements by decoupling entities, components, and
systems, thereby enhancing flexibility and modularity. Through parallelization, we aimed to improve
the scalability and performance of ABM simulations, which are often computationally expensive due
to the complex interactions between agents. Our results demonstrate that ECS provides a suitable
framework for parallelizing ABM simulations, especially in scenarios with a large number of agents
and interactions.</p>
      <p>While this study has provided insights into the benefits and limitations of parallelization in ECS-based
ABM engines, there are several areas for future exploration:
• Investigating the use of heterogeneous computing resources, such as GPU and FPGA acceleration,
in conjunction with ECS logic could ofer further performance gains. Understanding how to map
ECS operations to these architectures will be a key challenge.
• ECS architectures may incur overhead in memory usage due to the separation of components and
systems. Future work could investigate memory optimization techniques to reduce the footprint
of ECS-based ABM engines.
• Expanding the benchmarking suite to include a wider variety of ABM scenarios, such as those
with varying interaction complexity, agent heterogeneity, and environmental dynamics.
• Exploring hybrid architectures that combine ECS with other modeling paradigms, such as standard
discrete-event simulation, could lead to more eficient engines that leverage the strengths of each
approach.</p>
      <p>Future research can address these challenges to further optimize ECS-based ABM engines, enabling
them to handle increasingly complex simulations while maximizing eficiency.</p>
    </sec>
    <sec id="sec-7">
      <title>Declaration on Generative AI</title>
      <p>During the preparation of this work, the author(s) used Generative AI for grammar and spelling checks.
After using these tool(s)/service(s), the author(s) reviewed and edited the content as needed and take(s)
full responsibility for the publication’s content.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A. F.</given-names>
            <surname>Siegenfeld</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Bar-Yam</surname>
          </string-name>
          ,
          <article-title>An Introduction to Complex Systems Science</article-title>
          and Its Applications,
          <year>Complexity 2020</year>
          (
          <year>2020</year>
          )
          <fpage>6105872</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>P. W.</given-names>
            <surname>Anderson</surname>
          </string-name>
          , More Is Diferent,
          <source>Science</source>
          <volume>177</volume>
          (
          <year>1972</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>T.-S.</given-names>
            <surname>Yun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Kim</surname>
          </string-name>
          , I.-C. Moon,
          <string-name>
            <given-names>J. W.</given-names>
            <surname>Bae</surname>
          </string-name>
          ,
          <article-title>Agent-Based Model for Urban Administration: A Case Study of Bridge Construction and its Trafic Dispersion Efect</article-title>
          ,
          <source>Journal of Artificial Societies and Social Simulation</source>
          <volume>25</volume>
          (
          <year>2022</year>
          )
          <article-title>5</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>B.</given-names>
            <surname>Alves</surname>
          </string-name>
          <string-name>
            <surname>Furtado</surname>
          </string-name>
          ,
          <article-title>PolicySpace2: Modeling Markets and Endogenous Public Policies</article-title>
          ,
          <source>Journal of Artificial Societies and Social Simulation</source>
          <volume>25</volume>
          (
          <year>2022</year>
          )
          <article-title>8</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>S.</given-names>
            <surname>Abar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. K.</given-names>
            <surname>Theodoropoulos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Lemarinier</surname>
          </string-name>
          ,
          <string-name>
            <surname>G. M.</surname>
          </string-name>
          <article-title>O'Hare, Agent Based Modelling and Simulation tools: A review of the state-of-art software</article-title>
          ,
          <source>Computer Science Review</source>
          <volume>24</volume>
          (
          <year>2017</year>
          )
          <fpage>13</fpage>
          -
          <lpage>33</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>S.</given-names>
            <surname>Luke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Ciofi-Revilla</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Panait</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Sullivan</surname>
          </string-name>
          , G. Balan,
          <article-title>Mason: A multiagent simulation environment</article-title>
          ,
          <source>Simulation</source>
          <volume>81</volume>
          (
          <year>2005</year>
          )
          <fpage>517</fpage>
          -
          <lpage>527</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>S.</given-names>
            <surname>Tisue</surname>
          </string-name>
          , U. Wilensky,
          <article-title>Netlogo: Design and implementation of a multi-agent modeling environment</article-title>
          ,
          <source>in: Proceedings of agent</source>
          , volume
          <year>2004</year>
          ,
          <year>2004</year>
          , pp.
          <fpage>7</fpage>
          -
          <lpage>9</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>M. J.</given-names>
            <surname>North</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N. T.</given-names>
            <surname>Collier</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Ozik</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E. R.</given-names>
            <surname>Tatara</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. M.</given-names>
            <surname>Macal</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Bragen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Sydelko</surname>
          </string-name>
          ,
          <article-title>Complex adaptive systems modeling with Repast Simphony, Compl</article-title>
          . Adap. Syst.
          <string-name>
            <surname>Modeling</surname>
          </string-name>
          (
          <year>2013</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>A.</given-names>
            <surname>Antelmi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Caramante</surname>
          </string-name>
          , G. Cordasco,
          <string-name>
            <surname>G. D'Ambrosio</surname>
          </string-name>
          ,
          <string-name>
            <surname>D. De Vinco</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          <string-name>
            <surname>Foglia</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          <string-name>
            <surname>Postiglione</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Spagnuolo</surname>
          </string-name>
          ,
          <article-title>Reliable and eficient agent-based modeling and simulation</article-title>
          ,
          <source>Journal of Artificial Societies and Social Simulation</source>
          <volume>27</volume>
          (
          <year>2024</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>H. R.</given-names>
            <surname>Parry</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Bithell</surname>
          </string-name>
          ,
          <article-title>Large scale agent-based modelling: A review and guidelines for model scaling, Agent-based models of geographical systems (</article-title>
          <year>2011</year>
          )
          <fpage>271</fpage>
          -
          <lpage>308</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>H. R.</given-names>
            <surname>Parry</surname>
          </string-name>
          ,
          <article-title>Agent-based modeling, large-scale simulations, Complex Social and Behavioral Systems: Game Theory</article-title>
          and
          <string-name>
            <surname>Agent-Based Models</surname>
          </string-name>
          (
          <year>2020</year>
          )
          <fpage>913</fpage>
          -
          <lpage>926</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>A.</given-names>
            <surname>Antelmi</surname>
          </string-name>
          , G. Cordasco,
          <string-name>
            <surname>G. D'Ambrosio</surname>
          </string-name>
          ,
          <string-name>
            <surname>D. De Vinco</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Spagnuolo</surname>
          </string-name>
          ,
          <source>Experimenting with AgentBased Model Simulation Tools, Applied Sciences</source>
          <volume>13</volume>
          (
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>L.</given-names>
            <surname>An</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Grimm</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Sullivan</surname>
          </string-name>
          ,
          <string-name>
            <surname>B. T. II</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Malleson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Heppenstall</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Vincenot</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Robinson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Ye</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Lindkvist</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Tang</surname>
          </string-name>
          , Challenges, tasks, and
          <article-title>opportunities in modeling agent-based complex systems</article-title>
          ,
          <source>Ecological Modelling</source>
          <volume>457</volume>
          (
          <year>2021</year>
          )
          <fpage>109685</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>S.</given-names>
            <surname>Raychaudhuri</surname>
          </string-name>
          ,
          <article-title>Introduction to monte carlo simulation</article-title>
          ,
          <source>in: 2008 Winter simulation conference, IEEE</source>
          ,
          <year>2008</year>
          , pp.
          <fpage>91</fpage>
          -
          <lpage>100</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>W.</given-names>
            <surname>Tang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Bennett</surname>
          </string-name>
          ,
          <source>The Explicit Representation of Context in Agent-Based Models of Complex Adaptive Spatial Systems, Annals of the Association of American Geographers</source>
          <volume>100</volume>
          (
          <year>2010</year>
          )
          <fpage>1128</fpage>
          -
          <lpage>1155</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <surname>D. B. Skillicorn</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Talia</surname>
          </string-name>
          ,
          <article-title>Models and languages for parallel computation</article-title>
          ,
          <source>Acm Computing Surveys (Csur) 30</source>
          (
          <year>1998</year>
          )
          <fpage>123</fpage>
          -
          <lpage>169</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>W.</given-names>
            <surname>Tang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <article-title>Hpabm: A hierarchical parallel simulation framework for spatially-explicit agent-based models</article-title>
          ,
          <source>Transactions in GIS 13</source>
          (
          <year>2009</year>
          )
          <fpage>315</fpage>
          -
          <lpage>333</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>D.</given-names>
            <surname>Wiebusch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. E.</given-names>
            <surname>Latoschik</surname>
          </string-name>
          ,
          <article-title>Decoupling the entity-component-system pattern using semantic traits for reusable realtime interactive systems</article-title>
          ,
          <source>in: 2015 IEEE 8th Workshop on Software Engineering</source>
          and
          <article-title>Architectures for Realtime Interactive Systems (SEARIS)</article-title>
          , IEEE,
          <year>2015</year>
          , pp.
          <fpage>25</fpage>
          -
          <lpage>32</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>A.</given-names>
            <surname>Antelmi</surname>
          </string-name>
          , G. Cordasco,
          <string-name>
            <surname>M. D'Auria</surname>
          </string-name>
          ,
          <string-name>
            <surname>D. De Vinco</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Negro</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Spagnuolo</surname>
          </string-name>
          ,
          <article-title>On evaluating rust as a programming language for the future of massive agent-based simulations</article-title>
          ,
          <source>in: Methods and Applications for Modeling and Simulation of Complex Systems: 19th Asia Simulation Conference, AsiaSim</source>
          <year>2019</year>
          , Singapore,
          <source>October 30-November 1</source>
          ,
          <year>2019</year>
          , Proceedings 19,
          <string-name>
            <surname>Springer</surname>
            <given-names>Singapore</given-names>
          </string-name>
          ,
          <year>2019</year>
          , pp.
          <fpage>15</fpage>
          -
          <lpage>28</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>C. W.</given-names>
            <surname>Reynolds</surname>
          </string-name>
          ,
          <article-title>Flocks, herds and schools: A distributed behavioral model</article-title>
          ,
          <source>in: Proceedings of the 14th annual conference on Computer graphics and interactive techniques</source>
          ,
          <year>1987</year>
          , pp.
          <fpage>25</fpage>
          -
          <lpage>34</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>J.</given-names>
            <surname>Chattopadhyay</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Arino</surname>
          </string-name>
          ,
          <article-title>A predator-prey model with disease in the prey</article-title>
          ,
          <source>Nonlinear analysis 36</source>
          (
          <year>1999</year>
          )
          <fpage>747</fpage>
          -
          <lpage>766</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <given-names>A. A.</given-names>
            <surname>Berryman</surname>
          </string-name>
          ,
          <article-title>The orgins and evolution of predator-prey theory</article-title>
          ,
          <source>Ecology</source>
          <volume>73</volume>
          (
          <year>1992</year>
          )
          <fpage>1530</fpage>
          -
          <lpage>1535</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>