Repository navigation
Start the language server from a JDK-managed AppCDS archive - #153
Merged
Merged
Conversation
The server now starts with -XX:+AutoCreateSharedArchive and an archive next to the compiler jar: the JVM writes it when the first session ends (about 1.2 s more, once), and the sessions after it start from it. Language server start to ready, median of four starts: 4.39 s to 3.71 s on a small project, 18.98 s to 17.28 s on castle fight. It needs the base archive of the runtime, which the distribution of the compiler now builds (jlink --generate-cds-archive); without one the JVM runs as before. Two things the JVM does not handle, so appCdsJvmOptions does: - an archive for another jar, or another runtime, is ignored but never replaced, so an update would leave the server without one. The archive is named after the runtime, jar path, size and modification time, and the archives of others are removed; - when it cannot write the archive the JVM ends with a crash status. No options when a probe file cannot be written next to the jar. -Xlog:disable keeps JVM messages about the archive off stdout, which is the protocol stream. Two first sessions at once both end cleanly and leave a valid archive. test:appcds covers the options; scripts/test-lsp-appcds.js (opt-in, needs a built compiler distribution like test-lsp-readiness.js) starts the real server three times: first session writes the archive, the second leaves it, an updated jar gets a new one.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
What
The language server now starts with
-XX:+AutoCreateSharedArchiveand an AppCDS archive next to the compiler jar. The JVM writes it when the first session ends (about 1.2 s more, once, 28 MB) and the sessions after it start from it.Language server start to the initial build being ready, interleaved, median of four starts:
It does nothing for a warm run in an open session (the server JVM is already warm); it is startup only.
It needs the base archive of the runtime. The distribution never had one, which is why the AppCDS archive the compiler build tried to ship was never made; the companion PR in WurstScript builds it (
jlink --generate-cds-archive) and drops the dead task. Without it the JVM runs as before, nothing breaks.Why
appCdsJvmOptionsdoes more than add the flagsTwo things the JVM gets wrong, both seen while testing with the real distribution:
0xC0000409on Windows) when it cannot write the archive. No options are passed when a probe file cannot be written next to the jar.-Xlog:disablekeeps JVM messages about the archive off stdout, which is the protocol stream. Two first sessions at once (two windows) both end cleanly and leave a valid archive.Tests
npm run test:appcds(innpm test): the options, the archive name changing with jar and runtime, old archives removed and other files kept, no options for an unwritable folder or a missing jar.node scripts/test-lsp-appcds.js <compiler.jar> <java>(opt-in, liketest-lsp-readiness.js): starts the real server three times; first session writes the archive, second leaves it, an updated jar gets a new one. Run against the distribution built from the WurstScript PR.tsc,eslint,test-language-features,test-diagnosticspass (with the pinned dependencies; an oldnode_moduleswith vscode-languageclient 9 fails the client 10 test andtscon master too).Companion: wurstscript/WurstScript#1386 (base archive in the runtime).