using BenchmarkTools, StaticArrays
f(u, v) = u*v'
struct ConcType end
F(::Type{ConcType}, u, v) = f(u, v)
F(::ConcType, u, v) = f(u, v)
@btime f(a, b) setup = (a = SVector(1.0,2.0); b = SVector(1.0,2.0,3.0,4.0))
@btime F(cvar, a, b) setup = (cvar = ConcType(); a = SVector(1.0,2.0); b = SVector(1.0,2.0,3.0,4.0))
@btime F(ctyp, a, b) setup = (ctyp = ConcType; a = SVector(1.0,2.0); b = SVector(1.0,2.0,3.0,4.0))
I believe benchmarks in global scope involving non-constants like ctyp and cvar are problematic, but I don’t know all the details and use setup at least in critical cases like this one.