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

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

Build:
Build:
LAST BUILD BRANCH: perf/default-status-single-read
DEFAULT BRANCH: master
Ran 01 Sep 2026 08:53PM UTC
Jobs 32
Files 169
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 Sep 2026 08:52PM UTC coverage: 96.933% (-0.02%) from 96.951%
33557906942

Pull #2881

github

ericproulx
Decide whether a request has a body before building a Rack::Request

`Formatter#read_body_input` opened with

    input = rack_request.body # reads RACK_INPUT
    return if input.nil?
    return unless read_body_input?

so every request built a `Rack::Request` to reach `rack.input`, and then
`read_body_input?` returned false for anything that is not a POST, PUT, PATCH
or DELETE. On the GET, HEAD and OPTIONS majority the object was constructed,
asked for one env key, and discarded.

`read_body_input?` opened with four `Rack::Request` predicates —
`post? || put? || patch? || delete?` — each of which is a comparison against
`env['REQUEST_METHOD']`. Reading that key directly answers the same question
without the object, and it is the first thing the method needs to know.

Test the method off the env, and fetch the input only once the answer is yes.
A body-carrying request builds the `Rack::Request` exactly as before, for the
`form_data?` / `parseable_data?` / `content_length` checks that genuinely need
it; everything else never touches one.

Counted over 20 GETs, the formatter's copy is gone: 20 objects of the
`Rack::Request` family are created rather than 40, the survivor being the
`Grape::Request` the endpoint builds for itself.

End to end that is 166,376 -> 168,173 req/s on a bare JSON GET (+1.1%) and
257,731 -> 261,704 on a static route (+1.5%) — median of 9 runs interleaved
with master's, Ruby 4.0.5 with YJIT — with one fewer object per request.

The reordering is behaviour-preserving. Nothing between the two guards depends
on the input having been read, and `read_body_input?` consults only the request
method, the content type and the content length — never the body.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Pull Request #2881: Decide whether a request has a body before building a Rack::Request

1237 of 1332 branches covered (92.87%)

Branch coverage included in aggregate %.

4 of 4 new or added lines in 1 file covered. (100.0%)

3915 of 3983 relevant lines covered (98.29%)

27233.31 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-4.0-Gemfile - 33557906942.1 01 Sep 2026 08:55PM UTC 168
95.69
GitHub Action Run
2 run-4.0-gemfiles/rack_3_1.gemfile - 33557906942.2 01 Sep 2026 08:55PM UTC 168
95.69
GitHub Action Run
3 run-3.3-gemfiles/rack_2_2.gemfile - 33557906942.3 01 Sep 2026 08:56PM UTC 168
95.65
GitHub Action Run
4 run-4.0-gemfiles/rails_8_0.gemfile - 33557906942.4 01 Sep 2026 08:57PM UTC 169
95.69
GitHub Action Run
5 run-3.3-Gemfile - 33557906942.5 01 Sep 2026 08:57PM UTC 168
95.69
GitHub Action Run
6 run-3.4-gemfiles/rack_3_2.gemfile - 33557906942.6 01 Sep 2026 08:55PM UTC 168
95.69
GitHub Action Run
7 run-3.4-gemfiles/rack_3_1.gemfile - 33557906942.7 01 Sep 2026 08:55PM UTC 168
95.69
GitHub Action Run
8 run-3.4-gemfiles/rack_3_0.gemfile - 33557906942.8 01 Sep 2026 08:56PM UTC 168
95.69
GitHub Action Run
9 run-3.3-gemfiles/rack_3_2.gemfile - 33557906942.9 01 Sep 2026 08:56PM UTC 168
95.69
GitHub Action Run
10 run-3.4-gemfiles/rails_8_1.gemfile - 33557906942.10 01 Sep 2026 08:57PM UTC 169
95.69
GitHub Action Run
11 run-4.0-gemfiles/multi_xml_0_8.gemfile - 33557906942.11 01 Sep 2026 08:56PM UTC 168
46.94
GitHub Action Run
12 run-4.0-gemfiles/rails_8_1.gemfile - 33557906942.12 01 Sep 2026 08:56PM UTC 169
95.69
GitHub Action Run
13 run-4.0-gemfiles/dry_validation.gemfile - 33557906942.13 01 Sep 2026 08:55PM UTC 168
57.83
GitHub Action Run
14 run-4.0-gemfiles/hashie.gemfile - 33557906942.14 01 Sep 2026 08:57PM UTC 168
61.8
GitHub Action Run
15 run-3.3-gemfiles/rails_8_1.gemfile - 33557906942.15 01 Sep 2026 08:56PM UTC 169
95.69
GitHub Action Run
16 run-4.0-gemfiles/multi_json_1_20.gemfile - 33557906942.16 01 Sep 2026 08:53PM UTC 168
47.43
GitHub Action Run
17 run-4.0-gemfiles/rails_7_2.gemfile - 33557906942.17 01 Sep 2026 08:57PM UTC 169
95.69
GitHub Action Run
18 run-4.0-gemfiles/grape_swagger.gemfile - 33557906942.18 01 Sep 2026 08:56PM UTC 168
55.21
GitHub Action Run
19 run-4.0-gemfiles/grape_entity.gemfile - 33557906942.19 01 Sep 2026 08:56PM UTC 168
50.31
GitHub Action Run
20 run-3.4-gemfiles/rack_2_2.gemfile - 33557906942.20 01 Sep 2026 08:55PM UTC 168
95.65
GitHub Action Run
21 run-3.3-gemfiles/rails_8_0.gemfile - 33557906942.21 01 Sep 2026 08:57PM UTC 169
95.69
GitHub Action Run
22 run-3.3-gemfiles/rails_7_2.gemfile - 33557906942.22 01 Sep 2026 08:56PM UTC 169
95.69
GitHub Action Run
23 run-4.0-gemfiles/rack_3_2.gemfile - 33557906942.23 01 Sep 2026 08:57PM UTC 168
95.69
GitHub Action Run
24 run-4.0-gemfiles/multi_xml.gemfile - 33557906942.24 01 Sep 2026 08:56PM UTC 168
46.9
GitHub Action Run
25 run-3.4-gemfiles/rails_8_0.gemfile - 33557906942.25 01 Sep 2026 08:57PM UTC 169
95.69
GitHub Action Run
26 run-3.3-gemfiles/rack_3_1.gemfile - 33557906942.26 01 Sep 2026 08:56PM UTC 168
95.69
GitHub Action Run
27 run-4.0-gemfiles/rack_3_0.gemfile - 33557906942.27 01 Sep 2026 08:57PM UTC 168
95.69
GitHub Action Run
28 run-4.0-gemfiles/multi_json.gemfile - 33557906942.28 01 Sep 2026 08:55PM UTC 168
47.39
GitHub Action Run
29 run-3.3-gemfiles/rack_3_0.gemfile - 33557906942.29 01 Sep 2026 08:56PM UTC 168
95.69
GitHub Action Run
30 run-4.0-gemfiles/rack_2_2.gemfile - 33557906942.30 01 Sep 2026 08:56PM UTC 168
95.65
GitHub Action Run
31 run-3.4-Gemfile - 33557906942.31 01 Sep 2026 08:56PM UTC 168
95.69
GitHub Action Run
32 run-3.4-gemfiles/rails_7_2.gemfile - 33557906942.32 01 Sep 2026 08:55PM UTC 169
95.69
GitHub Action Run
Source Files on build 33557906942
  • Tree
  • List 169
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #33557906942
  • Pull Request #2881
  • PR Base - master (#33553778244)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc