Closed Tortar closed 4 months ago
This cuts down 2-3x for agent macro instantiation (e.g. from 0.2 s to 0.08 s), and 5x for multiagent (e.g. from 1 s to 0.2 s) e.g. now
julia> @time @eval @multiagent struct :opt_memory Animal{T,N,J}(GridAgent{2}) @subagent struct Wolf{T,N} energy::T = 0.5 ground_speed::N const fur_color::Symbol end @subagent struct Hawk{T,N,J} energy::T = 0.1 ground_speed::N flight_speed::J end end 0.143237 seconds (62.43 k allocations: 4.143 MiB, 25.01% gc time, 79.19% compilation time)
before
julia> @time @eval @multiagent :opt_memory struct Animal{T,N,J}(GridAgent{2}) @subagent struct Wolf{T,N} energy::T = 0.5 ground_speed::N const fur_color::Symbol end @subagent struct Hawk{T,N,J} energy::T = 0.1 ground_speed::N flight_speed::J end end 1.064352 seconds (974.18 k allocations: 64.895 MiB, 2.83% gc time, 93.72% compilation time: 67% of which was recompilation)
This cuts down 2-3x for agent macro instantiation (e.g. from 0.2 s to 0.08 s), and 5x for multiagent (e.g. from 1 s to 0.2 s) e.g. now
before