Skip to content

Commit d98e8dc

Browse files
authored
Return early from bootstraping symbols if paths are empty (#2078)
### Motivation Another tiny improvement that I identified during studying memory dumps. When passing a constant list to Tapioca, we end up invoking `symbols_from_paths` with an empty array. Currently, it will still create an empty tempfile and run Sorbet on it, which is unnecessary. ### Implementation We can return an empty set directly if no paths are given.
2 parents 768aab0 + e764ae1 commit d98e8dc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/tapioca/static/symbol_loader.rb

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def gem_symbols(gem)
5151

5252
sig { params(paths: T::Array[Pathname]).returns(T::Set[String]) }
5353
def symbols_from_paths(paths)
54+
return Set.new if paths.empty?
55+
5456
output = Tempfile.create("sorbet") do |file|
5557
file.write(Array(paths).join("\n"))
5658
file.flush

0 commit comments

Comments
 (0)