JuliaLang / Pkg.jl

Pkg - Package manager for the Julia programming language
https://pkgdocs.julialang.org
Other
616 stars 258 forks source link

Precompile REPLMode.repl_init, add force_compile #3711

Open mkitti opened 9 months ago

mkitti commented 9 months ago

Adds some precompilation for Pkg.REPLMode.repl_init

Removes direct reference to Base.active_repl

Add Base.Experimental.@force_compile

mkitti commented 9 months ago

Before

julia> @time_imports using Pkg
      0.6 ms  Printf
     37.1 ms  Dates
      0.5 ms  TOML
               ┌ 0.0 ms NetworkOptions.__init__() 
     40.8 ms  NetworkOptions 81.56% compilation time
               ┌ 0.4 ms MbedTLS_jll.__init__() 
      0.8 ms  MbedTLS_jll
               ┌ 0.2 ms LibSSH2_jll.__init__() 
      0.4 ms  LibSSH2_jll
               ┌ 0.2 ms LibGit2_jll.__init__() 
      0.4 ms  LibGit2_jll
     13.4 ms  LibGit2
     17.7 ms  ArgTools
               ┌ 0.1 ms nghttp2_jll.__init__() 
      0.5 ms  nghttp2_jll
               ┌ 0.2 ms LibCURL_jll.__init__() 
      0.4 ms  LibCURL_jll
               ┌ 6.8 ms MozillaCACerts_jll.__init__() 98.61% compilation time
      7.2 ms  MozillaCACerts_jll 93.41% compilation time
               ┌ 0.0 ms LibCURL.__init__() 
      2.2 ms  LibCURL
               ┌ 0.2 ms Downloads.Curl.__init__() 
     32.0 ms  Downloads
      1.1 ms  Tar
               ┌ 23.4 ms p7zip_jll.__init__() 99.32% compilation time
     23.7 ms  p7zip_jll 97.87% compilation time
      0.3 ms  UUIDs
               ┌ 0.0 ms Logging.__init__() 
      0.7 ms  Logging
      1.1 ms  Serialization
               ┌ 0.0 ms Pkg.REPLMode.__init__() 
               ├ 55.5 ms Pkg.__init__() 97.88% compilation time
    678.9 ms  Pkg 8.00% compilation time

After this pull request

julia> @time_imports using Pkg
      0.6 ms  Printf
     35.7 ms  Dates
      0.5 ms  TOML
               ┌ 0.0 ms NetworkOptions.__init__() 
     38.0 ms  NetworkOptions 81.84% compilation time
               ┌ 0.4 ms MbedTLS_jll.__init__() 
      0.7 ms  MbedTLS_jll
               ┌ 0.1 ms LibSSH2_jll.__init__() 
      0.3 ms  LibSSH2_jll
               ┌ 0.2 ms LibGit2_jll.__init__() 
      0.4 ms  LibGit2_jll
     13.6 ms  LibGit2
     19.6 ms  ArgTools
               ┌ 0.1 ms nghttp2_jll.__init__() 
      0.5 ms  nghttp2_jll
               ┌ 0.2 ms LibCURL_jll.__init__() 
      0.4 ms  LibCURL_jll
               ┌ 6.2 ms MozillaCACerts_jll.__init__() 98.84% compilation time
      6.5 ms  MozillaCACerts_jll 94.66% compilation time
               ┌ 0.0 ms LibCURL.__init__() 
      1.6 ms  LibCURL
               ┌ 0.2 ms Downloads.Curl.__init__() 
     29.8 ms  Downloads
      1.1 ms  Tar
               ┌ 22.1 ms p7zip_jll.__init__() 99.36% compilation time
     22.5 ms  p7zip_jll 97.80% compilation time
      0.3 ms  UUIDs
               ┌ 0.0 ms Logging.__init__() 
      0.9 ms  Logging
      1.5 ms  Serialization
               ┌ 0.0 ms Pkg.REPLMode.__init__() 
               ├ 30.7 ms Pkg.__init__() 96.54% compilation time
    644.4 ms  Pkg 4.60% compilation time
mkitti commented 9 months ago

CI failure on macOS is unrelated.

Username for 'https://github.com/': Username for 'https://github.com/': fatal: could not read Username for 'https://github.com/': terminal prompts disabled
fatal: could not read Username for 'https://github.com/': terminal prompts disabled
testing: Test Failed at /Users/runner/work/Pkg.jl/Pkg.jl/test/pkg.jl:244
  Expression: any(endswith(".cov"), readdir(pkgdir))