julia - 如何判断一个方法编译了哪些特化?
问题描述
在性能提示中,它说f(x::Int...) = tuple(x...)
不会专门化。它还建议用于(@which f(...)).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)
我该如何解释TypeMapEntry
?如何以编程方式访问它(我发现很难从输出中读取)?它做了多少专业?
解决方案
今天早上刚刚注册的MethodAnalysis包应该可以为您提供所需的一切。(你问这个问题的时机非常好!)
推荐阅读
- java - 掷骰子的 Java 方法每次都返回“双倍”
- html - 将样式应用于放置在另一个表中的特定子表
- python - 如果输入的重量不在列表中,我如何使它不出现错误(索引错误)
- c++ - 通过指针或引用将映射传递给函数?
- java - 是否有可用于在 Javadoc 中嵌入 Graphviz DOT 代码的 doclet?
- javascript - 检查对提示的响应是否为某个字符串
- sql - 如何制作案例陈述并忽略用户的输入 postgres
- asp.net - 为什么 asp.net web api 响应得到太多时间
- c# - 如何将参数子字符串转换为 C# 中的列类型?
- javascript - 将跨度值除以静态数字 - JS