Open-Source Wikis

/

Ruby

/

By the numbers

ruby/ruby

By the numbers

Data collected on 2026-04-30 from this checkout (HEAD 096c9bb9e0, branch master).

Size

xychart-beta horizontal
    title "Lines of code by primary language"
    x-axis ["C", "Ruby", "C headers", "Rust", "DSL/codegen", "Make"]
    y-axis "Lines"
    bar [3220000, 1800000, 240000, 150000, 60000, 50000]

(The C number is dominated by parse.c/prism.c/compile.c/io.c/string.c, all six-figure files. The Ruby number is dominated by vendored default-gem code under lib/rubygems/, lib/bundler/, lib/uri/, and tool/.)

Language Files (approx.)
C (.c) 493
C headers (.h) 455
Ruby (.rb) 7,588
Rust (.rs) 151
DSL (.def, .y, .mk, .in, m4) hundreds

The largest single source file is compile.c (513 KB / ~14,800 lines) followed by parse.y (519 KB) and prism/prism.c (~980 KB, generated). io.c, string.c, process.c, and numeric.c are each 150-450 KB.

Activity

Commit history (HEAD as of this snapshot):

Window Commits
All time (since 1998) ~98,500
Last 12 months ~13,800
Since April 2025 ~7,700

Top hand-edited subsystems by churn over the last 12 months (rough estimate):

Subsystem Notes
zjit/ Newest JIT, under heavy active development
yjit/ Continued tuning and feature work
prism/ Frequent syncs from the upstream Prism repo
gc/default/ Compaction, write barriers, shape-aware GC
lib/bundler/, lib/rubygems/ Synced from upstream gem repos
parse.y Maintenance + Lrama-driven changes

Bot-attributed commits

A nontrivial slice of commits in the last 12 months are co-authored by automation:

  • dependabot[bot] — dependency bumps for vendored Cargo.lock and CI actions
  • Copilot[bot] — auto-generated PRs from GitHub Copilot
  • github-actions[bot] — bookkeeping commits in some workflows

This is a lower bound on AI-assisted work since inline AI tools (Copilot, Cursor, etc.) leave no trace in git history.

Test corpus

Suite Files (approx.) Location
bootstraptest ~30 bootstraptest/
test/ (test-unit) thousands test/ruby/, test/<gem>/
spec/ruby/ thousands spec/ruby/
benchmark/ hundreds benchmark/

spec/ruby is a vendored copy of the ruby/spec repository — a behaviour spec shared with JRuby and TruffleRuby.

Bundled C extensions

ext/ contains ~40 production-grade C extensions, the largest being:

  • ext/openssl/ — TLS, hashing, and crypto bindings (≈12,000 lines of C + Ruby)
  • ext/socket/ — Berkeley sockets
  • ext/psych/ — YAML 1.1 (libyaml binding)
  • ext/json/ — JSON parser and generator
  • ext/digest/ — SHA1/SHA2/MD5/Bcrypt
  • ext/io/console/, ext/io/wait/, ext/io/nonblock/ — IO helpers
  • ext/fiber/ — Fiber implementation glue
  • ext/objspace/ — Object-space introspection
  • ext/zlib/, ext/etc/, ext/fcntl/, ext/pty/ — Unix glue

Standard library packages (default gems)

lib/ contains ~80 default-gem libraries. The largest by lines of Ruby:

Library Lines (approx.) Purpose
lib/rubygems/ ~50,000 Package manager
lib/bundler/ ~30,000 Dependency manager
lib/optparse.rb (+ lib/optparse/) ~3,000 CLI option parser
lib/uri/ ~3,000 URI parsing
lib/net/http.rb ~2,500 HTTP client
lib/erb.rb ~1,000 Embedded Ruby templating
lib/syntax_suggest/ ~3,000 "Did you mean" for syntax errors

JIT footprints

JIT Crate location Approx. lines of Rust
YJIT yjit/ ~30,000
ZJIT zjit/ ~70,000 (with bindgen)

Test-to-code ratio

Roughly 1.5 lines of test (test/ + spec/ruby/) per line of Ruby in lib/, plus a separate ratio for C tests in bootstraptest/. Coverage is broadest for the language semantics (spec/ruby/) and the long-standing standard library.

Other observations

  • The repository was imported from CVS in January 1998 (392296c12d and 3db12e8b23 are the genesis commits). The actual codebase predates the import by ~3 years.
  • defs/, template/, and tool/ together contain the project's significant code-generation footprint — many of the largest "source" files (prism/prism.c, parse.c) are generated.
  • The repository has no Git submodules; tool/sync_default_gems.rb is the mechanism for vendoring upstream gem code.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

By the numbers – Ruby wiki | Factory