Could it just be a missing type annotation on Vararg
?
EDIT: yes, that’s it
function multinomial_fast(a, vals::Vararg{Int,N}) where N
s = a
ret = 1.0
for v in vals
s += v
ret *= mybinomial(s,v)
end
return ret
end
julia> @btime multinomial($1,$2,$3,$4,$3)
32.190 ns (1 allocation: 16 bytes)
3.6036e6
julia> @btime multinomial_fast($1,$2,$3,$4,$3)
17.924 ns (0 allocations: 0 bytes)
3.6036e6