ruby / ruby/rdoc

Potential for reducing number of ri files

Open
#1,819 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
930
Forks
465
Avg merge
3d 10h
Merged PRs (30d)
27

Description

Is there currently a way to generate .ri files in a more bundled way to reduce the number of files generated? Or it would seem this would be an optimization worth discussing given some statistical analysis.

  1. .ri (and .rb) files are disproportionately populous compared to other file types in a typical Homebrew installation.
cd /opt/homebrew
find . -type f | sed 's/.*\.//' | sort | uniq -c | sort -nr | head
80487 ri
10922 rb
 7478 py
 6551 h
 5838 3
 2476 html
 2338 js
 1765 po
 1729 gz
 1641 elc
  1. 95% of files are under 1k.
  Dir['/opt/homebrew/lib/ruby/gems/4.0.0/doc/*'].each do
    files = Dir["#{it}/**/*.ri"].select { File.file?(it) }
    files.each { puts Math.log(File.size(it), 10).floor }
  end
ri.sh | sort | uniq -c | sort -nr
66580 2
 3898 3
  193 4
    8 5
  1. Some gems like RuboCop, Parser and Prism have disproportionately many files.
  Dir['/opt/homebrew/lib/ruby/gems/4.0.0/doc/*'].each do
    files = Dir["#{it}/**/*.ri"].select { File.file?(it) }
    total = files.sum { File.size(it) } # .tap { warn Math.log(it, 10).floor }
    printf "%d\t%d\t%s\n", total / 1e3, files.length, it.split('/')[8..].join('/')
  end
ri.sh | sort -n
5068	8957	rubocop-1.90.0
2929	8861	parser-3.3.12.0
2544	5406	prism-1.9.0
1558	2653	language_server-protocol-3.17.0.6
1276	1539	rdoc-8.0.0
1231	2284	yard-0.9.45
1005	2110	rubygems-4.0.20
 922	2463	rbs-4.2.0
 914	1347	concurrent-ruby-1.3.8
 888	1579	simplecov-1.2.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files, tests, or entry points are named. Start by tracing how RDoc generates .ri files and compare the observed file counts and sizes; done means establishing whether a bundled representation is feasible and defining the scope of an implementation or follow-up proposal.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.