Skip to content

Build outgoing messages without runtime dispatch - #129

Merged
pfitzseb merged 1 commit into
julia-vscode:mainfrom
PatrickHaecker:static-message-dicts
Oct 25, 2026
Merged

pfitzseb merged 1 commit into
julia-vscode:mainfrom
PatrickHaecker:static-message-dicts

Conversation

@PatrickHaecker

Copy link
Copy Markdown

Optimizing startup time and this makes julia-vscode a bit faster. It's not much, but the goal is a compilation-free startup.


🤖:

The send functions take params, result and the error fields as @nospecialize values. Building a pair from such a value with => dispatches at runtime, so the first message with a new value type compiled a Pair constructor at runtime, and the Dict constructor and the JSON writer were called dynamically as well. The julia-vscode REPL compiled Pair(String, Nothing) this way on every start (8-16 ms), because the system image holds that method without native code and a package image cannot add it.

The messages are now Dict{String,Any} built from explicit Pair{String,Any} entries, which the compiler resolves statically. The JSON written to the wire is unchanged apart from key order, which JSON does not define. A new test checks the compiled send functions for runtime-dispatched calls that build or serialize a message.

For every PR, please check the following:

The send functions take params, result and the error fields as @nospecialize
values. Building a pair from such a value with => dispatches at runtime, so the
first message with a new value type compiled a Pair constructor at runtime, and
the Dict constructor and the JSON writer were called dynamically as well. The
julia-vscode REPL compiled Pair(String, Nothing) this way on every start
(8-16 ms), because the system image holds that method without native code and
a package image cannot add it.

The messages are now Dict{String,Any} built from explicit Pair{String,Any}
entries, which the compiler resolves statically. The JSON written to the wire
is unchanged apart from key order, which JSON does not define. A new test
checks the compiled send functions for runtime-dispatched calls that build or
serialize a message.
@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.25%. Comparing base (3c43ccc) to head (288f343).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #129      +/-   ##
==========================================
+ Coverage   88.31%   89.25%   +0.94%     
==========================================
  Files           5        5              
  Lines         539      540       +1     
==========================================
+ Hits          476      482       +6     
+ Misses         63       58       -5     
Flag Coverage Δ
unittests 89.25% <100.00%> (+0.94%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@pfitzseb
pfitzseb merged commit 10f4999 into julia-vscode:main Oct 25, 2026
161 checks passed
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.

2 participants