-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
latencyLatencyLatencyobservabilitymetrics, timing, understandability, reflection, logging, ...metrics, timing, understandability, reflection, logging, ...
Description
If you write a method that ends up being inferred to a Const(...)
return value:
julia> const k = rand(1:100)
61
julia> foo() = *(k, 15, 12)
julia> @code_typed foo()
CodeInfo(
1 ─ return 10980
) => Int64
it will not be included in the --trace-compile
output:
$ julia --trace-compile=stderr -e "const k = rand(1:100); (foo() = *(k, 15)); println(foo())"
precompile(Tuple{typeof(Base.rand), Base.UnitRange{Int64}})
precompile(Tuple{typeof(Base.println), Int64})
precompile(Tuple{typeof(Base.println), Base.TTY, Int64})
705
Even though we ran our compilation pipeline on foo()
for the first time (generating a new CodeInstance), it ended up not needing to compile via LLVM so it is excluded from the output.
A user may hope to use the output of --trace-compile
to determine whether they should add precompile(foo, ())
to the pre-compilation workload, If we had reported this MethodInstance, it would have saved them that inference time.
Metadata
Metadata
Assignees
Labels
latencyLatencyLatencyobservabilitymetrics, timing, understandability, reflection, logging, ...metrics, timing, understandability, reflection, logging, ...