Skip to content

Document the cost of require 'facets' - #339

Merged
trans merged 1 commit into
mainfrom
claude/github-connector-capabilities-4qcre6
Sep 27, 2026
Merged

trans merged 1 commit into
mainfrom
claude/github-connector-capabilities-4qcre6

Conversation

@trans

@trans trans commented Sep 27, 2026

Copy link
Copy Markdown
Member

Adds measured figures for require 'facets' (the core library only) to the guide and the README.

The figures

Measured on Ruby 3.3.6, Linux, without Bootsnap:

require 'facets'
Load time added ~35 ms (median of 20 runs, compared with a bare ruby -e '')
Resident memory added ~1.8 MB (0.6 MB of Ruby heap)
Files loaded 448, all from lib/core; nothing from lib/standard or lib/rails
Methods defined ~858

No single file costs more than about 1.3 ms; the time is spread evenly across many small files. So there's no hot spot to optimize. Cherry-picking requires, or Bootsnap, remain the ways to load faster.

Where it goes

  • Guide, "Load what fits": a short paragraph after the loading examples. It notes that the figures cover the core library only, that standard library extensions load on demand, and that numbers vary by machine.
  • README, "The core collection": one clause with the same figures.

Checks

  • Rebuilt with ruby docs/build.rb. Only learn.html changes.
  • The section renders cleanly at desktop width with no overflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E2Njj4j1r9twkVcXsMySLW


Generated by Claude Code

Measured on Ruby 3.3.6, Linux, without Bootsnap: require 'facets' (the
core library only) adds about 35 ms of load time (median of 20 runs)
and 1.8 MB of resident memory, loading 448 files that define about 858
methods. No single file costs more than about 1.3 ms; the time is
spread evenly across many small files.

The guide's "Load what fits" section and the README's core-collection
paragraph now say so, noting that it covers the core library only and
that numbers vary by machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2Njj4j1r9twkVcXsMySLW
@trans
trans merged commit 824fc71 into main Sep 27, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants