Skip to content

Commit

Permalink
Drop benchmark dependency (#2511)
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain authored Aug 29, 2024
1 parent 2f5cb4f commit 2d81704
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions exe/ruby-lsp
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,17 @@ if options[:debug]
end

if options[:time_index]
require "benchmark"

index = RubyIndexer::Index.new

result = Benchmark.realtime { index.index_all }
time_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
index.index_all
elapsed_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - time_start

entries = index.instance_variable_get(:@entries)
entries_by_entry_type = entries.values.flatten.group_by(&:class)

puts <<~MSG
Ruby LSP v#{RubyLsp::VERSION}: Indexing took #{result.round(5)} seconds and generated:
Ruby LSP v#{RubyLsp::VERSION}: Indexing took #{elapsed_time.round(5)} seconds and generated:
- #{entries_by_entry_type.sort_by { |k, _| k.to_s }.map { |k, v| "#{k.name.split("::").last}: #{v.size}" }.join("\n- ")}
MSG
return
Expand Down

0 comments on commit 2d81704

Please sign in to comment.