Revise should precompile more methods
With
if isinteractive()
using Revise
end
in ~/.julia/config/startup.jl and Julia 1.11.4 I get
> julia --trace-compile=stderr -ie "exit()"
precompile(Tuple{typeof(Revise.iswritable), String})
precompile(Tuple{typeof(Base.first), Array{Any, 1}})
precompile(Tuple{typeof(Base.iszero), Float64})
precompile(Tuple{Revise.var"#118#119"})
precompile(Tuple{typeof(Revise.active_repl_backend_available)})
precompile(Tuple{typeof(FileWatching.uvfinalize), FileWatching.FileMonitor})
while without using Revise there is no precompile done in the above test case.
I think I could address two from six with #901. However, I do not have the knowledge (yet?) to tackle the other four. I can try again after fully grasping this backedge-thingy.
Ok, I need help here. After reading the precompilation tutorial, I thought that introducing a backedge would do the trick like in
__first() = Base.first(Any[])
@warnpcfail precompile(__first, ())
but that was not successful. Calling the backedge explicitly is also not successful:
__first() = Base.first(Any[1])
__first()
So who knows how to get rid of the remaining four precompilations during runtime?
Status with Julia 1.12.0-rc1 and Revise v3.8.0:
precompile(Tuple{typeof(Base.indexed_iterate), Tuple{String, Array{Base.CacheHeaderIncludes, 1}, Array{Base.PkgId, 1}, UInt128}, Int64})
precompile(Tuple{typeof(Base.indexed_iterate), Tuple{String, Array{Base.CacheHeaderIncludes, 1}, Array{Base.PkgId, 1}, UInt128}, Int64, Int64})
precompile(Tuple{typeof(Base.setproperty!), Revise.PkgData, Symbol, Array{Base.PkgId, 1}})
precompile(Tuple{typeof(Base.iterate), Array{Base.CacheHeaderIncludes, 1}})
precompile(Tuple{typeof(Base.getproperty), Base.CacheHeaderIncludes, Symbol})
precompile(Tuple{Type{Pair{A, B} where B where A}, String, Revise.FileInfo})
precompile(Tuple{typeof(Base.iterate), Array{Base.CacheHeaderIncludes, 1}, Int64})
precompile(Tuple{typeof(Base._atexit), Int32}) # recompile
precompile(Tuple{typeof(Base.iszero), Float64})
precompile(Tuple{Revise.var"#__init__##0#__init__##1"})