• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-grape / grape / 26339299050 / 24
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: fix/recompile-settings-mutation-race
DEFAULT BRANCH: master
Ran 23 May 2026 06:40PM UTC
Files 163
Run time 11s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 May 2026 05:40PM UTC coverage: 95.691% (+0.004%) from 95.687%
26339299050.24

Pull #2740

github

ericproulx
Lazy-allocate `@api_class` and `@point_in_time_copies` on InheritableSetting

`InheritableSetting#initialize` used to eagerly allocate both fields up
front. Neither is touched on most settings layers:

- `@api_class` is only written by external code (e.g. plugins) via
  `setting.api_class[:k] = v`; nothing in `lib/` writes to it.
- `@point_in_time_copies` only fills up on settings that get cloned via
  `point_in_time_copy` — typically the API-class-level setting, not the
  per-endpoint copies that make up the bulk of allocations at boot.

Switch both to memoizing readers (`@x ||= …`), drop the eager init, and
rewrite the `inherit_from` propagation loop to access the ivar directly
with `&.each` so the no-copies path doesn't allocate the Array just to
iterate zero elements.

Measured against master:

  Grape::Util::InheritableSetting.new × 100
    before: 1600 objects, 183.6 kB
    after:  1400 objects, 164.1 kB   (-11%)

Stacks with #2739 (lazy `@new_values`) for compounded boot-time savings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2740: Lazy-allocate @api_class and @point_in_time_copies on InheritableSetting

1065 of 1175 branches covered (90.64%)

Branch coverage included in aggregate %.

3487 of 3582 relevant lines covered (97.35%)

989.41 hits per line

Source Files on job run-3.3-gemfiles/rack_3_0.gemfile - 26339299050.24
  • Tree
  • List 163
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 26339299050
  • 6bea55d1 on github
  • Prev Job for on perf/lazy-inheritable-setting-fields (#26292056269.5)
  • Next Job for on perf/lazy-inheritable-setting-fields (#26468366305.8)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc