Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPL help menu has significant latency on master #56074

Open
jakobnissen opened this issue Oct 9, 2024 · 1 comment
Open

REPL help menu has significant latency on master #56074

jakobnissen opened this issue Oct 9, 2024 · 1 comment
Milestone

Comments

@jakobnissen
Copy link
Contributor

jakobnissen commented Oct 9, 2024

In stdlib/REPL/src/precompile.jl, the line ? reinterpret is added as part of REPL's precompilation script.
Unfortunately, I still see some latency when running precisely that line - perhaps due to the use of the new styled string, or syntax highlighting standard libraries.

The two GIFs below illustrate the difference between 1.11.0 and current master.

Image
Image

@KristofferC
Copy link
Member

KristofferC commented Oct 9, 2024

We are compiling a bunch of the parser and Markdown code etc.

Biggest ones are:

#=   61.8 ms =# precompile(Tuple{typeof(Base.JuliaSyntax.core_parser_hook), Base.SubString{String}, String, Int64, Int64, Symbol})
#=   67.5 ms =# precompile(Tuple{typeof(Markdown.term), Base.IOContext{Base.TTY}, Markdown.Code, Int64})
#=   59.4 ms =# precompile(Tuple{typeof(Markdown.term), Base.IOContext{Base.TTY}, Markdown.Paragraph, Int64})
#=  212.6 ms =# precompile(Tuple{typeof(Markdown.term), Base.IOContext{Base.TTY}, Markdown.Admonition, Int64})
#=  112.3 ms =# precompile(Tuple{typeof(Markdown.term), Base.IOContext{Base.TTY}, Markdown.Header{1}, Int64})
Full list
#=   12.6 ms =# precompile(Tuple{typeof(Base.print_to_string), String, String, String, String, String, String, String, String, String, String, Vararg{Any}})
#=    2.5 ms =# precompile(Tuple{typeof(Base.ispty), Base.TTY}) # recompile
#=   31.6 ms =# precompile(Tuple{typeof(Base.eof), Base.TTY})
#=    8.6 ms =# precompile(Tuple{Base.var"#readcb_specialized#uv_readcb##0", Base.TTY, Int64, UInt64})
#=   14.6 ms =# precompile(Tuple{typeof(Base.peek), Base.TTY, Type{UInt8}})
#=    6.7 ms =# precompile(Tuple{typeof(Base.get), Base.Dict{Char, Any}, Char, Nothing})
#=    2.6 ms =# precompile(Tuple{Base.Returns{Symbol}, Any})
#=    3.1 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Base.GenericIOBuffer{Memory{UInt8}}, Bool, Bool}, Int64})
#=    3.4 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Base.GenericIOBuffer{Memory{UInt8}}, Bool, Bool}, Int64, Int64}) # recompile
#=    2.5 ms =# precompile(Tuple{Base.JuliaSyntax.var"#invoke_fixedworld#fix_world_age##2"{Base.JuliaSyntax.var"#invoke_fixedworld#108#fix_world_age##3"{typeof(Base.JuliaSyntax.core_parser_hook), UInt64}}, Base.SubString{String}, Vararg{Any}})
#=    2.5 ms =# precompile(Tuple{Base.JuliaSyntax.var"#invoke_fixedworld#108#fix_world_age##3"{typeof(Base.JuliaSyntax.core_parser_hook), UInt64}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Base.JuliaSyntax.var"#invoke_fixedworld#fix_world_age##2"{Base.JuliaSyntax.var"#invoke_fixedworld#108#fix_world_age##3"{typeof(Base.JuliaSyntax.core_parser_hook), UInt64}}, Base.SubString{String}, Vararg{Any}}) # recompile
#=   61.8 ms =# precompile(Tuple{typeof(Base.JuliaSyntax.core_parser_hook), Base.SubString{String}, String, Int64, Int64, Symbol})
#=   30.1 ms =# precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{Expr, Int64}})
#=    2.8 ms =# precompile(Tuple{typeof(Base.all), Function, Tuple{Nothing}})
#=    2.0 ms =# precompile(Tuple{typeof(Base.getindex), Base.RefValue{Ptr{UInt8}}}) # recompile
#=    1.7 ms =# precompile(Tuple{typeof(Base.cconvert), Type{Ptr{UInt8}}, Ptr{UInt8}}) # recompile
#=    1.8 ms =# precompile(Tuple{typeof(Base.getindex), Base.RefValue{Int32}}) # recompile
#=    1.7 ms =# precompile(Tuple{typeof(Base.unsafe_convert), Type{Ptr{UInt8}}, Ptr{UInt8}}) # recompile
#=    3.2 ms =# precompile(Tuple{Type{NamedTuple{(:brief, :mod, :internal_accesses), T} where T<:Tuple}, Tuple{Bool, Module, Base.Set{Pair{Module, Symbol}}}})
#=   29.2 ms =# precompile(Tuple{typeof(Base.Docs.docm), LineNumberNode, Module, Any})
#=   16.0 ms =# precompile(Tuple{typeof(Core.Compiler.return_type), Any, DataType})
#=   12.8 ms =# precompile(Tuple{typeof(Core.Compiler.return_type), Core.Compiler.NativeInterpreter, DataType})
#=    3.0 ms =# precompile(Tuple{typeof(Base.setindex!), Array{typeof(Base.Docs.doc), 1}, Function, Int64})
#=    3.2 ms =# precompile(Tuple{typeof(Base.setindex!), Array{Expr, 1}, Expr, Int64}) # recompile
#=    2.0 ms =# precompile(Tuple{typeof(Base.unsafe_convert), Type{Ptr{Ptr{UInt8}}}, Base.RefValue{Ptr{UInt8}}}) # recompile
#=    2.0 ms =# precompile(Tuple{typeof(Base.unsafe_convert), Type{Ptr{Int32}}, Base.RefValue{Int32}}) # recompile
#=    2.5 ms =# precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Memory{UInt8}}}, Char}) # recompile
#=    3.4 ms =# precompile(Tuple{typeof(Base.getindex), Base.IdDict{Any, Any}, Any})
#=   14.6 ms =# precompile(Tuple{typeof(Markdown.footnote_link), Base.GenericIOBuffer{Memory{UInt8}}, Markdown.MD})
#=    2.2 ms =# precompile(Tuple{Type{NamedTuple{(:match,), T} where T<:Tuple}, Tuple{Char}}) # recompile
#=   43.3 ms =# precompile(Tuple{typeof(Markdown.link), Base.GenericIOBuffer{Memory{UInt8}}, Markdown.MD})
#=    1.8 ms =# precompile(Tuple{typeof(Base.Docs.catdoc), Markdown.MD, Vararg{Markdown.MD}})
#=   21.6 ms =# precompile(Tuple{Type{Markdown.MD}, Markdown.MD, Vararg{Markdown.MD}}) # recompile
#=    9.8 ms =# precompile(Tuple{typeof(Base.vcat), Markdown.MD, Markdown.MD, Markdown.MD})
#=    3.2 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.Code, Bool}, Int64})
#=    3.0 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.Code, Bool}, Int64, Int64}) # recompile
#=    2.9 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.Paragraph, Bool}, Int64})
#=    3.0 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.Paragraph, Bool}, Int64, Int64}) # recompile
#=    3.0 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.Admonition, Bool}, Int64})
#=    3.5 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.Admonition, Bool}, Int64, Int64}) # recompile
#=    2.9 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.MD, Bool}, Int64})
#=    3.0 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.MD, Bool}, Int64, Int64}) # recompile
#=    1.7 ms =# precompile(Tuple{typeof(Base.Unicode.lowercase), String}) # recompile
#=    3.1 ms =# precompile(Tuple{typeof(Base.in), String, Tuple{String, String, String}}) # recompile
#=    3.0 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.Header{1}, Bool}, Int64})
#=    3.1 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.Header{1}, Bool}, Int64, Int64}) # recompile
#=   16.2 ms =# precompile(Tuple{typeof(Markdown.insert_hlines), Markdown.MD})
#=    4.0 ms =# precompile(Tuple{Type{Base.IOContext{IO_t} where IO_t<:IO}, Base.TTY, Pair{Symbol, Array{Tuple{String, Int64}, 1}}})
#=    2.8 ms =# precompile(Tuple{Type{Base.IOContext{IO_t} where IO_t<:IO}, Base.IOContext{Base.TTY}, Pair{Symbol, Module}})
#=   10.0 ms =# precompile(Tuple{typeof(Base.Multimedia.display), Any}) # recompile
#=    4.3 ms =# precompile(Tuple{Type{Base.IOContext{IO_t} where IO_t<:IO}, Base.IOContext{Base.TTY}, Pair{Symbol, Bool}, Pair{Symbol, Module}})
#=    2.1 ms =# precompile(Tuple{typeof(Base.print), Base.IOContext{Base.TTY}, String})
#=    2.3 ms =# precompile(Tuple{typeof(Base.write), Base.IOContext{Base.TTY}, String}) # recompile
#=    2.7 ms =# precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:init,), Tuple{Base.IOContext{Base.TTY}}}, typeof(Base.foldl), Type, Base.Dict{Symbol, Any}})
#=    2.5 ms =# precompile(Tuple{Base.var"##mapfoldl#246", Base.IOContext{Base.TTY}, typeof(Base.mapfoldl), Function, Type, Base.Dict{Symbol, Any}})
#=   19.2 ms =# precompile(Tuple{typeof(Base.mapfoldl_impl), typeof(Base.identity), Type{Base.IOContext{IO_t} where IO_t<:IO}, Base.IOContext{Base.TTY}, Base.Dict{Symbol, Any}})
#=   24.3 ms =# precompile(Tuple{typeof(Base.show), Base.IOContext{Base.TTY}, Base.Multimedia.MIME{:var"text/plain"}, Markdown.MD})
#=    2.2 ms =# precompile(Tuple{typeof(Markdown.term), Base.IOContext{Base.TTY}, Markdown.MD, Int64}) # recompile
#=    2.9 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Pair{Symbol, Symbol}, Int64}) # recompile
#=    4.0 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Pair{Symbol, Symbol}, Int64, Int64}) # recompile
#=    2.2 ms =# precompile(Tuple{Type{NamedTuple{(:raise,), T} where T<:Tuple}, Tuple{Bool}}) # recompile
#=    2.4 ms =# precompile(Tuple{typeof(Core.memoryref), Memory{Tuple{Base.UnitRange{Int64}, Union{Expr, Pair{Symbol, Any}, Symbol}}}}) # recompile
#=    2.4 ms =# precompile(Tuple{typeof(Base.isnothing), Int64}) # recompile
#=    3.1 ms =# precompile(Tuple{typeof(Base.:(==)), Bool, Bool}) # recompile
#=    2.7 ms =# precompile(Tuple{typeof(Core.memoryref), Memory{NamedTuple{(:pos, :active, :index), Tuple{Int64, Bool, Int64}}}}) # recompile
#=    2.5 ms =# precompile(Tuple{typeof(Core.memoryref), Memory{Array{Pair{Symbol, Any}, 1}}}) # recompile
#=    4.3 ms =# precompile(Tuple{typeof(Base.:(^)), Char, Int64}) # recompile
#=   17.6 ms =# precompile(Tuple{typeof(Base.repeat), Char, Int64}) # recompile
#=    2.1 ms =# precompile(Tuple{typeof(Base.:(|)), UInt32, UInt8}) # recompile
#=    1.9 ms =# precompile(Tuple{typeof(Base.leading_zeros), UInt32}) # recompile
#=    1.9 ms =# precompile(Tuple{typeof(Base.:(*)), Int64, UInt64}) # recompile
#=    1.9 ms =# precompile(Tuple{typeof(Base.convert), Type{UInt64}, UInt64}) # recompile
#=   67.5 ms =# precompile(Tuple{typeof(Markdown.term), Base.IOContext{Base.TTY}, Markdown.Code, Int64})
#=    4.6 ms =# precompile(Tuple{typeof(Base.getproperty), Base.JuliaSyntax.SyntaxHead, Symbol}) # recompile
#=    2.7 ms =# precompile(Tuple{typeof(Base.JuliaSyntax.is_string_delim), Base.JuliaSyntax.GreenNode{Base.JuliaSyntax.SyntaxHead}})
#=    2.6 ms =# precompile(Tuple{typeof(Base.JuliaSyntax.is_number), Base.JuliaSyntax.Kind}) # recompile
#=    2.3 ms =# precompile(Tuple{typeof(Base.JuliaSyntax.is_prec_assignment), Base.JuliaSyntax.Kind}) # recompile
#=    2.9 ms =# precompile(Tuple{typeof(Base.JuliaSyntax.is_prec_comparison), Base.JuliaSyntax.Kind})
#=    2.7 ms =# precompile(Tuple{typeof(Base.isempty), Array{Base.JuliaSyntax.GreenNode{Base.JuliaSyntax.SyntaxHead}, 1}})
#=    3.3 ms =# precompile(Tuple{typeof(Base.getindex), Array{Base.JuliaSyntax.GreenNode{Base.JuliaSyntax.SyntaxHead}, 1}, Int64}) # recompile
#=    2.1 ms =# precompile(Tuple{typeof(Base.JuliaSyntax.kind), Base.JuliaSyntax.GreenNode{Base.JuliaSyntax.SyntaxHead}}) # recompile
#=    2.3 ms =# precompile(Tuple{typeof(Base.JuliaSyntax.is_prefix_call), Base.JuliaSyntax.GreenNode{Base.JuliaSyntax.SyntaxHead}})
#=    2.7 ms =# precompile(Tuple{typeof(Base.JuliaSyntax.is_trivia), Base.JuliaSyntax.GreenNode{Base.JuliaSyntax.SyntaxHead}}) # recompile
#=    3.3 ms =# precompile(Tuple{typeof(Base.findfirst), Function, Array{Base.JuliaSyntax.GreenNode{Base.JuliaSyntax.SyntaxHead}, 1}})
#=   10.1 ms =# precompile(Tuple{typeof(Base.getindex), Array{Base.JuliaSyntax.GreenNode{Base.JuliaSyntax.SyntaxHead}, 1}, Base.UnitRange{Int64}})
#=    2.3 ms =# precompile(Tuple{typeof(Base.sum), Function, Array{Base.JuliaSyntax.GreenNode{Base.JuliaSyntax.SyntaxHead}, 1}})
#=    2.3 ms =# precompile(Tuple{typeof(Base._mapreduce_dim), Function, Function, Base._InitialValue, Array{Base.JuliaSyntax.GreenNode{Base.JuliaSyntax.SyntaxHead}, 1}, Base.Colon})
#=    2.4 ms =# precompile(Tuple{typeof(Core.memoryref), Memory{Base.SubString{Base.AnnotatedString{String}}}}) # recompile
#=   49.2 ms =# precompile(Tuple{typeof(Base.split), Base.AnnotatedString{String}, Char})
#=    2.4 ms =# precompile(Tuple{typeof(Base.Iterators.enumerate), Array{Base.SubString{Base.AnnotatedString{String}}, 1}})
#=    5.8 ms =# precompile(Tuple{typeof(Base.getindex), Array{Base.SubString{Base.AnnotatedString{String}}, 1}, Int64})
#=   41.2 ms =# precompile(Tuple{typeof(Base.print), Base.IOContext{Base.TTY}, String, Base.SubString{Base.AnnotatedString{String}}})
#=    2.2 ms =# precompile(Tuple{typeof(Base.foldl), Function, Array{StyledStrings.Face, 1}})
#=    1.8 ms =# precompile(Tuple{Base.var"##mapfoldl#246", Base._InitialValue, typeof(Base.mapfoldl), Function, Function, Array{StyledStrings.Face, 1}})
#=   21.9 ms =# precompile(Tuple{typeof(Base.mapfoldl_impl), typeof(Base.identity), typeof(Base.merge), Base._InitialValue, Array{StyledStrings.Face, 1}}) # recompile
#=   59.4 ms =# precompile(Tuple{typeof(Markdown.term), Base.IOContext{Base.TTY}, Markdown.Paragraph, Int64})
#=    7.0 ms =# precompile(Tuple{typeof(Markdown.annotprint), Function, Array{Any, 1}})
#=    6.0 ms =# precompile(Tuple{typeof(Markdown.terminline), Base.AnnotatedIOBuffer, Array{Any, 1}})
#=    2.3 ms =# precompile(Tuple{Type{Pair{A, B} where B where A}, Base.Regex, Char}) # recompile
#=   32.3 ms =# precompile(Tuple{typeof(Markdown.terminline), Base.AnnotatedIOBuffer, String})
#=   10.4 ms =# precompile(Tuple{typeof(Markdown.terminline), Base.AnnotatedIOBuffer, Markdown.Code})
#=    4.6 ms =# precompile(Tuple{typeof(Base.vect), Tuple{Base.UnitRange{Int64}, Pair{Symbol, Any}}}) # recompile
#=    2.0 ms =# precompile(Tuple{typeof(Base.print), Base.AnnotatedIOBuffer, Base.AnnotatedString{String}}) # recompile
#=    3.0 ms =# precompile(Tuple{typeof(Base.getproperty), Base.Order.By{typeof(Base.first), Base.Order.ForwardOrdering}, Symbol}) # recompile
#=    4.3 ms =# precompile(Tuple{typeof(Markdown.terminline), Base.AnnotatedIOBuffer, Markdown.Link})
#=   19.0 ms =# precompile(Tuple{typeof(Markdown.with_output_annotations), Markdown.var"#terminline##4#terminline##5"{Markdown.Link}, Base.AnnotatedIOBuffer, Pair{Symbol, var"#s46"} where var"#s46", Vararg{Pair{Symbol, var"#s46"} where var"#s46"}}) # recompile
#=    2.4 ms =# precompile(Tuple{typeof(Base.Iterators.enumerate), Tuple{Pair{Symbol, Symbol}}}) # recompile
#=    1.9 ms =# precompile(Tuple{Base.BottomRF{typeof(Base.:(+))}, Base._InitialValue, Int64}) # recompile
#=  212.6 ms =# precompile(Tuple{typeof(Markdown.term), Base.IOContext{Base.TTY}, Markdown.Admonition, Int64})
#=    7.0 ms =# precompile(Tuple{typeof(Markdown.annotprint), Function, Array{Any, 1}, Vararg{Any}})
#=   16.0 ms =# precompile(Tuple{typeof(Markdown.term), Base.AnnotatedIOBuffer, Array{Any, 1}, Int64})
#=   33.1 ms =# precompile(Tuple{typeof(Markdown.term), Base.AnnotatedIOBuffer, Markdown.Paragraph, Int64})
#=   12.9 ms =# precompile(Tuple{typeof(Markdown.term), Base.IOContext{Base.TTY}, Markdown.HorizontalRule, Int64})
#=  112.3 ms =# precompile(Tuple{typeof(Markdown.term), Base.IOContext{Base.TTY}, Markdown.Header{1}, Int64})
#=   14.4 ms =# precompile(Tuple{typeof(Markdown.with_output_annotations), Markdown.var"#term##6#term##7"{Int64, Char}, Base.IOContext{Base.AnnotatedIOBuffer}, Pair{Symbol, var"#s46"} where var"#s46"})
#=    2.3 ms =# precompile(Tuple{typeof(Base.println), Base.IOContext{Base.TTY}}) # recompile
#=    2.6 ms =# precompile(Tuple{typeof(Base.print), Base.TTY, String}) # recompile
#=    2.1 ms =# precompile(Tuple{REPL.var"#setup_interface##10#setup_interface##11"{REPL.REPLHistoryProvider}, Any})

@KristofferC KristofferC added this to the 1.12 milestone Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants