Skip to content

Commit

Permalink
Use PrecompileTools mechanics to compile REPL (#55782)
Browse files Browse the repository at this point in the history
Fixes #55778

Based on discussion here
#55778 (comment)

With this `?reinterpret` feels instant, with only these precompiles at
the start.
![Screenshot 2024-09-16 at 9 49
39 AM](https://github.com/user-attachments/assets/20dc016d-c6f7-4870-acd7-0e795dcf541b)
  • Loading branch information
IanButterworth authored Sep 17, 2024
1 parent 5aad761 commit 02549d5
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions stdlib/REPL/src/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ finally
Base._track_dependencies[] = true
end

let
function repl_workload()
# these are intentionally triggered
allowed_errors = [
"BoundsError: attempt to access 0-element Vector{Any} at index [1]",
Expand Down Expand Up @@ -175,9 +175,38 @@ let
nothing
end

precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Any, Int})
precompile(Tuple{typeof(Base.delete!), Base.Set{Any}, String})
precompile(Tuple{typeof(Base.:(==)), Char, String})
precompile(Tuple{typeof(Base.reseteof), Base.TTY})
# Copied from PrecompileTools.jl
let
function check_edges(node)
parentmi = node.mi_info.mi
for child in node.children
childmi = child.mi_info.mi
if !(isdefined(childmi, :backedges) && parentmi childmi.backedges)
precompile(childmi.specTypes)
end
check_edges(child)
end
end

if Base.generating_output() && Base.JLOptions().use_pkgimages != 0
Core.Compiler.Timings.reset_timings()
Core.Compiler.__set_measure_typeinf(true)
try
repl_workload()
finally
Core.Compiler.__set_measure_typeinf(false)
Core.Compiler.Timings.close_current_timer()
end
roots = Core.Compiler.Timings._timings[1].children
for child in roots
precompile(child.mi_info.mi.specTypes)
check_edges(child)
end
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Any, Int})
precompile(Tuple{typeof(Base.delete!), Base.Set{Any}, String})
precompile(Tuple{typeof(Base.:(==)), Char, String})
precompile(Tuple{typeof(Base.reseteof), Base.TTY})
end
end

end # Precompile

2 comments on commit 02549d5

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Please sign in to comment.