Use Base.Precompilation.precompilepkgs in ensurecompiled - #1131
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This was referenced Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since Julia 1.11 Pkg is not in the sysimage, so under
--pkgimages=no(whichensurecompiledalways 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.precompilepkgsis whatPkg.precompiledelegates 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 keepsPkg.precompile(), since Pkg is in the sysimage there and it is already fast.Verified by calling
ensurecompileddirectly with a project depending on Example, cache deleted first:Alternative to #1127.
🤖 Generated with Claude Code