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

Make REPL not slow-down if we load a valid cachefile #51565

Merged
merged 4 commits into from
Oct 5, 2023
Merged

Conversation

vchuravy
Copy link
Sponsor Member

@vchuravy vchuravy commented Oct 3, 2023

Fixes #51532.

We have funny series of interactions. With the REPL and its dependencies being removed from the system image,
we observed latency regressions when users create their own precompilation cache of REPL.

During the precompilation of REPL we launch a subordinate process that we send statements too.
Now we do want that process to use the existing cache of the REPL dependencies so we launch it with
--compiled-modules=existing. Otherwise precompilation of REPL is even slower than it is now.

When the user triggers recompilation of REPL due to the use of -O3 the subordinate process sees
a valid cache file for REPL itself. Thus no (or very few) precompilation statements are being
generated. Leading to the cache file compiled with -O3 to have a significant latency regression.

In this PR I work around this by replaying the precompilation statements of REPL from the subordinate
process. A bit hacky, but should be more reliable than trying to set up a "just right" depot,
or filtering the REPL cache-file out.

@brenhinkeller brenhinkeller added performance Must go faster stdlib:REPL Julia's REPL (Read Eval Print Loop) labels Oct 3, 2023
src/gf.c Outdated Show resolved Hide resolved
@vchuravy vchuravy added the status:merge me PR is reviewed. Merge when all tests are passing label Oct 5, 2023
@vchuravy vchuravy merged commit 91f8020 into master Oct 5, 2023
7 checks passed
@vchuravy vchuravy deleted the vc/repl_slowdown branch October 5, 2023 13:45
@vtjnash
Copy link
Sponsor Member

vtjnash commented Oct 5, 2023

I don't know what it is doing currently, but the cache files should not be left to the whims of using REPL, but be getting loaded by exactly:

Base._tryrequire_from_serialized(pkg::PkgId, path::String, ocachepath::Union{Nothing, String})

If as subprocess it required. With the path and ocachepath values from Base.pkgorigins[pkg]

@vchuravy
Copy link
Sponsor Member Author

vchuravy commented Oct 5, 2023 via email

@DilumAluthge DilumAluthge removed the status:merge me PR is reviewed. Merge when all tests are passing label Oct 16, 2023
@IanButterworth
Copy link
Sponsor Member

IanButterworth commented Jan 7, 2024

@vtjnash I've been trying to implement your suggestion but, to reiterate @vchuravy the issue is that this using REPL is within the subprocess and is called with --compiled-modules=existing, and REPL has no cache file yet.

Update: Found another way around it: #52783 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster stdlib:REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

initial slowdowns in every fresh REPL session
5 participants