Revise.jl icon indicating copy to clipboard operation
Revise.jl copied to clipboard

Revise should precompile more methods

Open PatrickHaecker opened this issue 8 months ago • 3 comments

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.

PatrickHaecker avatar Apr 07 '25 15:04 PatrickHaecker

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.

PatrickHaecker avatar Apr 07 '25 16:04 PatrickHaecker

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?

PatrickHaecker avatar Apr 08 '25 04:04 PatrickHaecker

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"})

PatrickHaecker avatar Aug 21 '25 10:08 PatrickHaecker