As a heuristic, Julia avoids automatically specializing on argument type parameters in three specific cases:
Type,Function, andVararg. Julia will always specialize when the argument is used within the method, but not if the argument is just passed through to another function. This usually has no performance impact at runtime and improves compiler performance. If you find it does have a performance impact at runtime in your case, you can trigger specialization by adding a type parameter to the method declaration.
https://docs.julialang.org/en/v1/manual/performance-tips/#Be-aware-of-when-Julia-avoids-specializing
By using ::Type{T}, you’re forcing julia to specialize the code.