You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/performance_tips.md
+5-9Lines changed: 5 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,12 +134,7 @@ t = joinpath(dirname(dirname(x)), "test", "performance", "variable_agent_types_s
134
134
include(t)
135
135
```
136
136
137
-
We see that Unions of up to three different Agent types do not suffer much.
138
-
Hence, if you have less than four agent types in your model, using different types is still a valid option.
139
-
For more agent types however we recommend using the [`@multiagent`](@ref) macro.
140
-
141
-
Finally, we also have a more realistic benchmark of the two approaches at `test/performance/multiagent_vs_union.jl` where the
142
-
result of running the model with the two methodologies are
137
+
Finally, we also have a more realistic benchmark of the two approaches at [`test/performance/multiagent_vs_union.jl`](https://github.com/JuliaDynamics/Agents.jl/blob/main/test/performance/multiagent_vs_union.jl) where each type has a different set of behaviours, unlike in the previous benchmark. The result of running the model with the two methodologies are
143
138
144
139
```@example performance_2
145
140
using Agents
@@ -148,7 +143,8 @@ t = joinpath(dirname(dirname(x)), "test", "performance", "multiagent_vs_union.jl
148
143
include(t)
149
144
```
150
145
151
-
In reality, we benchmarked the models also in Julia>=1.11 and from that version on a `Union` is considerably
152
-
more performant. Though, there is still a general 1.5-2x advantage in many cases in favour of [`@multiagent`](@ref),
153
-
so we suggest to use [`@multiagent`](@ref) only when the speed of the multi-agent simulation is really critical.
146
+
As you can see, [`@multiagent`](@ref) has the edge over a `Union`: there is a general 1.5-2x advantage in many cases
147
+
in its favour. This is true for Julia>=1.11, where we then suggest to go with [`@multiagent`](@ref) only if the speed of the
148
+
simulation is critical. However, keep in mind that on Julia<=1.10 the difference is much bigger: [`@multiagent`](@ref)
149
+
is almost one order of magnitude faster than a `Union`.
0 commit comments