Closed jesse-shopify closed 1 year ago
For gem RBIs we parse yard documentation by default https://github.com/Shopify/tapioca/blob/64c09e8bbc912e12916fd4adb719dde5f8109b68/lib/tapioca/cli.rb#L197-L200
Problem is parser
gem generates huge ruby files when installed. Parsing of these files by YARD is quite slow.
LOC:
File blank comment code
-----------------------------------------------------------------------------------------------
./lib/parser/lexer.rb 1078 3252 20685
./lib/parser/ruby31.rb 1401 245 6712
./lib/parser/ruby32.rb 1396 242 6700
./lib/parser/ruby30.rb 1361 244 6491
./lib/parser/ruby28.rb 1346 244 6457
./lib/parser/ruby27.rb 1331 234 6349
./lib/parser/ruby24.rb 1112 196 5428
./lib/parser/ruby26.rb 1115 201 5405
./lib/parser/ruby23.rb 1107 176 5386
./lib/parser/ruby25.rb 1109 201 5384
./lib/parser/ruby22.rb 1105 176 5374
./lib/parser/ruby21.rb 1101 176 5334
./lib/parser/ruby20.rb 1096 177 5290
./lib/parser/macruby.rb 1024 168 4985
./lib/parser/rubymotion.rb 1016 167 4942
./lib/parser/ruby19.rb 1017 169 4940
./lib/parser/ruby18.rb 914 156 4638
I think the best solution here would be to allow configuration of doc
option to be gem specific. We can then ignore parser
gem from being parsed.
One alternative you can use right now would be to exclude parser
, rbi
and tapioca
gems on your tapioca/config,yml
. It's probably being pulled in by tapioca so you don't need its RBIs for typechecking since you don't use the gem in your code. Another alternative is turning off doc
option for gem
command.
Jumping on here to say that a gem specific configuration of the doc
option would be very useful for me too - current versions of the aws-quicksight-ruby generates huge amounts of documentation, which took tapioca around 45minutes to handle (and resulted in a 30Mb rbi file)
Closing this in favour of the more actionable issue https://github.com/Shopify/tapioca/issues/1361
I noticed this a few days ago but have only recently dug into it. When generating an RBI for the
parser
gem the performance is much slower than any other gem I have come across.time bundle exec tapioca gem parser
Output (tapioca 10.2, parser 3.1.3.0):
bundle exec tapioca gem parser 180.31s user 17.23s system 98% cpu 3:19.76 total
Output (tapioca 10.3, parser 3.1.3.0):
bundle exec tapioca gem parser 187.51s user 16.53s system 99% cpu 3:24.77 total