In the performance tip, it says f(x::Int...) = tuple(x...)
will not specialize. It also suggests to use (@which f(...)).specializations
to check the specializations.
f(x::Int...) = tuple(x...)
f(1)
f(1, 2)
f(1, 2, 3)
f(1, 2, 3, 4)
a = first(methods(f)).specializations
Core.TypeMapEntry(Core.TypeMapEntry(nothing, Tuple{typeof(f),Int64}, nothing, svec(), 0x0000000000000001, 0xffffffffffffffff, MethodInstance for f(::Int64), true, true, false), Tuple{typeof(f),Int64,Vararg{Int64,N} where N}, nothing, svec(), 0x0000000000000001, 0xffffffffffffffff, MethodInstance for f(::Int64, ::Vararg{Int64,N} where N), false, true, true)
How do I interpret the TypeMapEntry
? How can I access it programatically (I find it hard to read from the output)? How many specializations has it made?
The MethodAnalysis package, registered just this morning, should give you everything you need. (Your timing in asking this question was excellent!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With