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

improve precompilation for st in the Pkg REPL #3893

Merged
merged 1 commit into from
May 6, 2024

Conversation

KristofferC
Copy link
Member

@KristofferC KristofferC commented May 6, 2024

Measurement:

julia> using Pkg, REPL

julia> const REPLExt = Base.get_extension(Pkg, :REPLExt)
REPLExt

julia> @time @eval REPLExt.do_cmds(Base.active_repl, "st")
Project Pkg v1.12.0
Status `~/JuliaPkgs/Pkg.jl/Project.toml`
  [56f22d72] Artifacts v1.11.0
  [ade2ca70] Dates v1.11.0
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching v1.11.0
  [76f85450] LibGit2 v1.11.0
  [8f399da3] Libdl v1.11.0
  [56ddb016] Logging v1.11.0
  [d6f4376e] Markdown v1.11.0
  [de0858da] Printf v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [cf7118a7] UUIDs v1.11.0
  [3f19e933] p7zip_jll v17.5.0+0

Before:

  1.232465 seconds (4.30 M allocations: 254.177 MiB, 7.91% gc time, 79.78% compilation time: 3% of which was recompilation)

After

  0.629539 seconds (1.92 M allocations: 131.477 MiB, 15.28% gc time, 52.50% compilation time: 8% of which was recompilation)

On 1.10 we have

julia> @time @eval Pkg.REPLMode.do_cmd(Base.active_repl, "st")
  0.431920 seconds (2.05 M allocations: 163.018 MiB, 4.72% gc time, 18.10% compilation time)

@gbaraldi
Copy link
Member

gbaraldi commented May 6, 2024

Adding

    Base.precompile(Tuple{typeof(Base.keys), Base.Dict{String, Base.Dict{String, Pkg.REPLMode.CommandSpec}}})
    Base.precompile(Tuple{typeof(Base.getproperty), Base.KeySet{String, Base.Dict{String, Base.Dict{String, Pkg.REPLMode.CommandSpec}}}, Symbol})
    Base.precompile(Tuple{Type{Pkg.REPLMode.QString}, String, Bool})
    Base.precompile(Tuple{typeof(REPL.LineEdit.complete_line), REPLExt.PkgCompletionProvider, REPL.LineEdit.PromptState})

makes the lag when typing on the Pkg repl go away.

@KristofferC
Copy link
Member Author

KristofferC commented May 6, 2024

The last two of those are already in this PR and the first two are pretty much instant to compile so I don't think those make a difference in practice. Also, in this PR, typing in the REPL seems instant to me.

@gbaraldi
Copy link
Member

gbaraldi commented May 6, 2024

Oh I missed the complete_line one (I imagine it's the one that makes a difference)

@KristofferC KristofferC merged commit c6c7ed5 into master May 6, 2024
7 checks passed
@KristofferC KristofferC deleted the kc/status_precompile branch May 6, 2024 20:19
KristofferC added a commit that referenced this pull request May 14, 2024
KristofferC added a commit that referenced this pull request May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants