Skip to content

Use Base.Precompilation.precompilepkgs in ensurecompiled - #1131

Merged
KristofferC merged 1 commit into
masterfrom
kc/ensurecompiled-base-precompilation
Sep 16, 2026
Merged

KristofferC merged 1 commit into
masterfrom
kc/ensurecompiled-base-precompilation

Conversation

@KristofferC

Copy link
Copy Markdown
Member

Since Julia 1.11 Pkg is not in the sysimage, so under --pkgimages=no (which ensurecompiled always passes) Pkg.precompile() has to JIT-compile all of Pkg before doing anything. On an empty project that is ~17 s with 99.97% compilation time, even though nothing gets precompiled. This is the slowdown reported in #1127.

Base.Precompilation.precompilepkgs is what Pkg.precompile delegates to and lives in the sysimage, so call it directly where available. Same call under the same flag takes ~0.02 s on an empty project. Julia 1.10 keeps Pkg.precompile(), since Pkg is in the sysimage there and it is already fast.

Verified by calling ensurecompiled directly with a project depending on Example, cache deleted first:

Julia cold warm
1.13 0.44 s (precompiled Example) 0.11 s
1.10 1.6 s (precompiled Example) 0.88 s

Alternative to #1127.

🤖 Generated with Claude Code

Since Julia 1.11 Pkg is not in the sysimage, so under `--pkgimages=no`
`Pkg.precompile()` JIT-compiles all of Pkg before doing anything, which
takes tens of seconds even when nothing needs precompiling.
`Base.Precompilation.precompilepkgs` is what Pkg delegates to and lives in
the sysimage, so call it directly where available.

Fixes the slowdown reported in #1127.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.47%. Comparing base (1568309) to head (6682055).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1131      +/-   ##
==========================================
+ Coverage   74.44%   74.47%   +0.02%     
==========================================
  Files           3        3              
  Lines         896      897       +1     
==========================================
+ Hits          667      668       +1     
  Misses        229      229              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KristofferC
KristofferC merged commit 2a1c21e into master Sep 16, 2026
13 checks passed
@KristofferC
KristofferC deleted the kc/ensurecompiled-base-precompilation branch September 16, 2026 13:06
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.

1 participant