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

ruby-grape / grape / 24695970162 / 17
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: perf/build-headers-each-header
DEFAULT BRANCH: master
Ran 20 Apr 2026 11:42PM UTC
Files 155
Run time 10s
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

20 Apr 2026 11:38PM UTC coverage: 95.634% (+0.001%) from 95.633%
24695970162.17

Pull #2690

github

ericproulx
Return frozen EMPTY array from StackableValues on miss

`StackableValues#[]` is the accessor behind `namespace_stackable[key]` —
called multiple times per request (five filter phases, plus ad-hoc
settings lookups). When neither `inherited_values` nor `new_values`
have an entry for the key, the old `return new_value || []` allocated
a fresh empty array on every miss.

Introduce a frozen `EMPTY` singleton and return it in the miss branch.
Saves two short-lived empty-array allocations per request in the
realistic shape (some filters set, some not) and up to five in the
worst case.

One caller (`Endpoint#initialize`) stored `namespace_stackable[:validations]`
directly into `route[:saved_validations]` by reference, and later
`.concat`'d parent validations into it via `inherit_settings`. With the
stackable now able to return a frozen array, that mutation would
`FrozenError`. Dup at capture so the route keeps its own mutable list —
good hygiene regardless of this change.

## Benchmark (1k iterations, 5-key probe per iteration)

Realistic (3 keys populated, 2 absent):
  current: 2.01 M i/s, 80B / 2 objects allocated
  variant: 2.19 M i/s, 0B / 0 objects allocated

Worst case (all 5 absent):
  current: 2.18 M i/s, 200B / 5 objects
  variant: 2.49 M i/s, 0B / 0 objects  (1.14x faster)

No behavior change; all 2,236 specs pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2690: Return frozen EMPTY array from StackableValues on miss

1047 of 1157 branches covered (90.49%)

Branch coverage included in aggregate %.

3312 of 3401 relevant lines covered (97.38%)

1006.94 hits per line

Source Files on job run-3.2-gemfiles/rails_8_0.gemfile - 24695970162.17
  • Tree
  • List 155
  • Changed 2
  • Source Changed 2
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 24695970162
  • a52b1dde on github
  • Prev Job for on perf/stackable-empty-singleton (#24693877550.6)
  • Next Job for on perf/stackable-empty-singleton (#24695984301.2)
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