-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed as not planned
Closed as not planned
Copy link
Labels
compiler:inferenceType inferenceType inferenceduplicateIndicates similar issues or pull requestsIndicates similar issues or pull requeststypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
Reproducer:
using JET
struct MyStruct
alist::Union{Nothing,Vector{Int}}
end
function f(m)
a = m.alist
a::Vector{Int}
a[1]
end
report_opt(f, Tuple{MyStruct}) # run time dispatchThis is with Julia v1.11, as JET doesn't work on nightly Julia:
julia> versioninfo()
Julia Version 1.11.0-beta2
Commit edb3c92d6a6 (2024-05-29 09:37 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)If this:
a::Vector{Int}
a[1]... is changed to:
(a::Vector{Int})[1]... then there's no run time dispatch!
Metadata
Metadata
Assignees
Labels
compiler:inferenceType inferenceType inferenceduplicateIndicates similar issues or pull requestsIndicates similar issues or pull requeststypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch