Skip to content

Commit 947c6f8

Browse files
committed
Drop the benchmark dependency
It is trivial, don't have to take on a dependency for that.
1 parent d52e57d commit 947c6f8

File tree

5 files changed

+10
-644
lines changed

5 files changed

+10
-644
lines changed

Gemfile.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ PATH
22
remote: .
33
specs:
44
tapioca (0.17.9)
5-
benchmark
65
bundler (>= 2.2.25)
76
netrc (>= 0.11.0)
87
parallel (>= 1.21.0)
@@ -110,7 +109,6 @@ GEM
110109
ast (2.4.3)
111110
base64 (0.3.0)
112111
bcrypt (3.1.20)
113-
benchmark (0.5.0)
114112
bigdecimal (3.3.1)
115113
builder (3.3.0)
116114
cityhash (0.9.0)

lib/tapioca/helpers/rbi_files_helper.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def index_rbi(index, kind, file)
1111
return unless File.exist?(file)
1212

1313
say("Loading #{kind} RBIs from #{file}... ")
14-
time = Benchmark.realtime do
14+
time = realtime do
1515
parse_and_index_files(index, [file], number_of_workers: 1)
1616
end
1717
say(" Done ", :green)
@@ -27,7 +27,7 @@ def index_rbis(index, kind, dir, number_of_workers:)
2727
else
2828
say("Loading #{kind} RBIs from #{dir}... ")
2929
end
30-
time = Benchmark.realtime do
30+
time = realtime do
3131
files = Dir.glob("#{dir}/**/*.rbi").sort
3232
parse_and_index_files(index, files, number_of_workers: number_of_workers)
3333
end
@@ -39,7 +39,7 @@ def index_rbis(index, kind, dir, number_of_workers:)
3939
def duplicated_nodes_from_index(index, shim_rbi_dir:, todo_rbi_file:)
4040
duplicates = {}
4141
say("Looking for duplicates... ")
42-
time = Benchmark.realtime do
42+
time = realtime do
4343
index.keys.each do |key|
4444
nodes = index[key]
4545
next unless shims_or_todos_have_duplicates?(nodes, shim_rbi_dir: shim_rbi_dir, todo_rbi_file: todo_rbi_file)
@@ -283,5 +283,12 @@ def update_gem_rbis_strictnesses(errors, gem_dir)
283283
def gem_name_from_rbi_path(path)
284284
T.must(File.basename(path, ".rbi").split("@").first)
285285
end
286+
287+
#: ?{ (?) -> untyped } -> (Integer | Float)
288+
def realtime(&block)
289+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
290+
yield
291+
Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
292+
end
286293
end
287294
end

lib/tapioca/internal.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
require "tapioca/rbs/rewriter"
2727
# ^ Do not change the order of these requires
2828

29-
require "benchmark"
3029
require "bundler"
3130
require "erb"
3231
require "etc"

0 commit comments

Comments
 (0)