One important benefit of using StaticArray is to avoid the memory allocation required for an Array. For now, there is type instability somewhere that results in allocations for type inference, which largely undermines the advantages of using StaticArray over Array.
using TransformVariables, StaticArrays, BenchmarkTools
tr = as(SVector{3, Float64})
a = rand(3)
julia> @btime transform($tr, $a)
39.816 ns (2 allocations: 32 bytes)
3-element SVector{3, Float64} with indices SOneTo(3):
0.8664582577624973
0.27172807097850415
0.5758008759582858
From @code_warntype, I see that there is type stability issue with transform_with.
One important benefit of using
StaticArray
is to avoid the memory allocation required for anArray
. For now, there is type instability somewhere that results in allocations for type inference, which largely undermines the advantages of usingStaticArray
overArray
.From
@code_warntype
, I see that there is type stability issue withtransform_with
.