Skip to content

Potential for reducing number of ri files #1819

Description

@forthrin

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions