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

ruby-grape / grape / 25214109046
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: security/mounted-rack-auth-and-html-escape
DEFAULT BRANCH: master
Ran 01 May 2026 12:22PM UTC
Jobs 37
Files 155
Run time 1min
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

01 May 2026 12:22PM UTC coverage: 96.984% (+0.004%) from 96.98%
25214109046

Pull #2696

github

ericproulx
Reduce per-request allocations on the request hot path

A bundle of small, behavior-preserving cleanups that drop allocations
or chain walks from every request. Stable values (filter buckets,
versioner options, etc.) are computed once at compile/init and read via
`attr_reader`, instead of being re-resolved through nested hash lookups
on every request.

* `Endpoint#run`: precompute filter buckets (befores, before_validations,
  after_validations, afters, finallies) and `:build_params_with` once
  in `compile!`; replace the dynamic `define_method` accessor block
  with `attr_reader`; remove a dead `header 'Allow', header['Allow']`
  self-assignment.

* `Versioner::Base`: replace the two `define_method`-per-key blocks
  (top-level and `version_options` keys) with `attr_reader` plus ivars
  precomputed in `initialize`. Per-request `pattern`/`prefix`/`vendor`/
  `strict`/etc. lookups now hit attr loads.

* `Request#make_params`: skip the `except(:version, :route_info)` hash
  allocation in the common case where routing args contain only the
  known keys.

* `Validators::Base#validate!`: lazy-allocate `array_errors`. Saves one
  Array allocation per validator per request when validation succeeds.

* `InheritableValues#[]`: drop the per-call merge with `Hash#fetch`
  plus a fallback block. Lookup is 1.55x faster microbenched, allocates
  zero. Mostly helps boot/compile time (where ~30+ reads per endpoint
  hit this).

* `Grape::API::Instance`: rename `ROOT_PREFIX_VERSIONING_KEY` to
  `ROOT_PREFIX_VERSIONING_KEYS` (it holds 3 symbols), pair via `zip`
  instead of `each_with_index` + manual indexing.

* `Validations::Types::CustomTypeCoercer#infer_coercion_method`:
  guard-clause refactor of the nested if/else.

End-to-end, 3-run averaged on Ruby 4.0.3, arm64-darwin25, against
`/api/v1/hello` returning a small JSON object:

                       no-yjit       yjit
  master HEAD:         52,088 i/s    101,563 i/s
  master + this PR:    57,433 i/s    107,982 i/... (continued)
Pull Request #2696: Reduce per-request allocations on the request hot path

1077 of 1161 branches covered (92.76%)

Branch coverage included in aggregate %.

65 of 66 new or added lines in 11 files covered. (98.48%)

4 existing lines in 3 files now uncovered.

3361 of 3415 relevant lines covered (98.42%)

32315.57 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
95.88
0.0% lib/grape/middleware/error.rb

Coverage Regressions

Lines Coverage ∆ File
2
95.88
0.0% lib/grape/middleware/error.rb
1
96.43
0.0% lib/grape/error_formatter/base.rb
1
97.39
0.0% lib/grape/middleware/formatter.rb
Jobs
ID Job ID Ran Files Coverage
1 run-3.4-Gemfile - 25214109046.1 01 May 2026 12:23PM UTC 154
95.66
GitHub Action Run
2 run-3.4-gemfiles/rack_3_2.gemfile - 25214109046.2 01 May 2026 12:22PM UTC 154
95.66
GitHub Action Run
3 run-4.0-gemfiles/hashie.gemfile - 25214109046.3 01 May 2026 12:23PM UTC 154
62.41
GitHub Action Run
4 run-3.3-gemfiles/rails_8_1.gemfile - 25214109046.4 01 May 2026 12:23PM UTC 155
95.64
GitHub Action Run
5 run-3.3-gemfiles/rack_3_2.gemfile - 25214109046.5 01 May 2026 12:23PM UTC 154
95.64
GitHub Action Run
6 run-3.2-gemfiles/rack_3_0.gemfile - 25214109046.6 01 May 2026 12:23PM UTC 154
95.69
GitHub Action Run
7 run-3.3-gemfiles/rails_7_2.gemfile - 25214109046.7 01 May 2026 12:23PM UTC 155
95.64
GitHub Action Run
8 run-3.3-gemfiles/rack_3_0.gemfile - 25214109046.8 01 May 2026 12:23PM UTC 154
95.64
GitHub Action Run
9 run-4.0-gemfiles/rack_2_2.gemfile - 25214109046.9 01 May 2026 12:23PM UTC 154
95.62
GitHub Action Run
10 run-4.0-gemfiles/rails_8_0.gemfile - 25214109046.10 01 May 2026 12:23PM UTC 155
95.67
GitHub Action Run
11 run-3.4-gemfiles/rack_3_0.gemfile - 25214109046.11 01 May 2026 12:23PM UTC 154
95.66
GitHub Action Run
12 run-3.4-gemfiles/rails_8_1.gemfile - 25214109046.12 01 May 2026 12:23PM UTC 155
95.67
GitHub Action Run
13 run-3.4-gemfiles/rails_8_0.gemfile - 25214109046.13 01 May 2026 12:23PM UTC 155
95.67
GitHub Action Run
14 run-3.2-gemfiles/rack_3_2.gemfile - 25214109046.14 01 May 2026 12:22PM UTC 154
95.69
GitHub Action Run
15 run-3.3-Gemfile - 25214109046.15 01 May 2026 12:23PM UTC 154
95.64
GitHub Action Run
16 run-3.3-gemfiles/rails_8_0.gemfile - 25214109046.16 01 May 2026 12:23PM UTC 155
95.64
GitHub Action Run
17 run-3.2-gemfiles/rack_3_1.gemfile - 25214109046.17 01 May 2026 12:23PM UTC 154
95.69
GitHub Action Run
18 run-3.4-gemfiles/rails_7_2.gemfile - 25214109046.18 01 May 2026 12:23PM UTC 155
95.67
GitHub Action Run
19 run-3.3-gemfiles/rack_3_1.gemfile - 25214109046.19 01 May 2026 12:23PM UTC 154
95.64
GitHub Action Run
20 run-3.2-gemfiles/rack_2_2.gemfile - 25214109046.20 01 May 2026 12:23PM UTC 154
95.64
GitHub Action Run
21 run-3.2-Gemfile - 25214109046.21 01 May 2026 12:23PM UTC 154
95.69
GitHub Action Run
22 run-4.0-gemfiles/rails_8_1.gemfile - 25214109046.22 01 May 2026 12:23PM UTC 155
95.67
GitHub Action Run
23 run-3.2-gemfiles/rails_7_2.gemfile - 25214109046.23 01 May 2026 12:23PM UTC 155
95.69
GitHub Action Run
24 run-4.0-gemfiles/grape_entity.gemfile - 25214109046.24 01 May 2026 12:23PM UTC 154
49.42
GitHub Action Run
25 run-4.0-gemfiles/rack_3_0.gemfile - 25214109046.25 01 May 2026 12:23PM UTC 154
95.66
GitHub Action Run
26 run-3.2-gemfiles/rails_8_0.gemfile - 25214109046.26 01 May 2026 12:23PM UTC 155
95.69
GitHub Action Run
27 run-3.4-gemfiles/rack_3_1.gemfile - 25214109046.27 01 May 2026 12:23PM UTC 154
95.66
GitHub Action Run
28 run-4.0-Gemfile - 25214109046.28 01 May 2026 12:23PM UTC 154
95.66
GitHub Action Run
29 run-3.2-gemfiles/rails_8_1.gemfile - 25214109046.29 01 May 2026 12:23PM UTC 155
95.69
GitHub Action Run
30 run-4.0-gemfiles/dry_validation.gemfile - 25214109046.30 01 May 2026 12:23PM UTC 154
57.74
GitHub Action Run
31 run-4.0-gemfiles/multi_xml.gemfile - 25214109046.31 01 May 2026 12:23PM UTC 154
35.77
GitHub Action Run
32 run-4.0-gemfiles/rack_3_1.gemfile - 25214109046.32 01 May 2026 12:23PM UTC 154
95.66
GitHub Action Run
33 run-4.0-gemfiles/rails_7_2.gemfile - 25214109046.33 01 May 2026 12:23PM UTC 155
95.67
GitHub Action Run
34 run-3.3-gemfiles/rack_2_2.gemfile - 25214109046.34 01 May 2026 12:23PM UTC 154
95.6
GitHub Action Run
35 run-4.0-gemfiles/multi_json.gemfile - 25214109046.35 01 May 2026 12:23PM UTC 154
35.77
GitHub Action Run
36 run-4.0-gemfiles/rack_3_2.gemfile - 25214109046.36 01 May 2026 12:23PM UTC 154
95.66
GitHub Action Run
37 run-3.4-gemfiles/rack_2_2.gemfile - 25214109046.37 01 May 2026 12:22PM UTC 154
95.62
GitHub Action Run
Source Files on build 25214109046
  • Tree
  • List 155
  • Changed 9
  • Source Changed 9
  • Coverage Changed 7
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #25214109046
  • Pull Request #2696
  • PR Base - master (#25137726391)
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