Skip to content
Open
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: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ PATH
remote: .
specs:
tapioca (0.17.9)
benchmark
bundler (>= 2.2.25)
netrc (>= 0.11.0)
parallel (>= 1.21.0)
Expand Down Expand Up @@ -110,7 +109,6 @@ GEM
ast (2.4.3)
base64 (0.3.0)
bcrypt (3.1.20)
benchmark (0.5.0)
bigdecimal (3.3.1)
builder (3.3.0)
cityhash (0.9.0)
Expand Down
13 changes: 10 additions & 3 deletions lib/tapioca/helpers/rbi_files_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def index_rbi(index, kind, file)
return unless File.exist?(file)

say("Loading #{kind} RBIs from #{file}... ")
time = Benchmark.realtime do
time = realtime do
parse_and_index_files(index, [file], number_of_workers: 1)
end
say(" Done ", :green)
Expand All @@ -27,7 +27,7 @@ def index_rbis(index, kind, dir, number_of_workers:)
else
say("Loading #{kind} RBIs from #{dir}... ")
end
time = Benchmark.realtime do
time = realtime do
files = Dir.glob("#{dir}/**/*.rbi").sort
parse_and_index_files(index, files, number_of_workers: number_of_workers)
end
Expand All @@ -39,7 +39,7 @@ def index_rbis(index, kind, dir, number_of_workers:)
def duplicated_nodes_from_index(index, shim_rbi_dir:, todo_rbi_file:)
duplicates = {}
say("Looking for duplicates... ")
time = Benchmark.realtime do
time = realtime do
index.keys.each do |key|
nodes = index[key]
next unless shims_or_todos_have_duplicates?(nodes, shim_rbi_dir: shim_rbi_dir, todo_rbi_file: todo_rbi_file)
Expand Down Expand Up @@ -283,5 +283,12 @@ def update_gem_rbis_strictnesses(errors, gem_dir)
def gem_name_from_rbi_path(path)
T.must(File.basename(path, ".rbi").split("@").first)
end

#: ?{ (?) -> untyped } -> (Integer | Float)
def realtime(&block)
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
yield
Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
end
end
end
1 change: 0 additions & 1 deletion lib/tapioca/internal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
require "tapioca/rbs/rewriter"
# ^ Do not change the order of these requires

require "benchmark"
require "bundler"
require "erb"
require "etc"
Expand Down
Loading
Loading