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

Run signature blocks ahead of time and compact after indexing #2460

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions exe/ruby-lsp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ require "ruby_lsp/load_sorbet"
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "ruby_lsp/internal"

T::Utils.run_all_sig_blocks
vinistock marked this conversation as resolved.
Show resolved Hide resolved

if options[:debug]
if ["x64-mingw-ucrt", "x64-mingw32"].include?(RUBY_PLATFORM)
$stderr.puts "Debugging is not supported on Windows"
Expand Down
5 changes: 5 additions & 0 deletions lib/ruby_lsp/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,11 @@ def perform_initial_indexing
send_message(Notification.window_show_error("Error while indexing: #{error.message}"))
end

# Indexing produces a high number of short lived object allocations. That might lead to some fragmentation and
# an unnecessarily expanded heap. Compacting ensures that the heap is as small as possible and that future
# allocations and garbage collections are faster
GC.compact

# Always end the progress notification even if indexing failed or else it never goes away and the user has no
# way of dismissing it
end_progress("indexing-progress")
Expand Down
Loading