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

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

Build:
Build:
LAST BUILD BRANCH: perf/build-headers-each-header
DEFAULT BRANCH: master
Ran 21 Jun 2026 11:23AM UTC
Jobs 32
Files 167
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

21 Jun 2026 11:22AM UTC coverage: 96.593% (+0.001%) from 96.592%
27902723616

Pull #2770

github

ericproulx
Avoid per-entry array allocation in Request#build_headers

`build_headers` walked the env with `each_header.with_object(...)`. Because
`Enumerator#with_object` hands the block a single value plus the memo, the
two values `each_header` yields (`k`, `v`) get boxed into a throwaway
`[k, v]` Array on every iteration — which the `|(k, v), headers|` destructure
then immediately unpacks. That is one array allocated, packed, destructured,
and discarded per request header.

Drop `with_object` for a plain `each_header do |k, v|` block writing into a
pre-built `Grape::Util::Header`. `k` and `v` arrive as separate block args
(normal multi-value yield), so no array is boxed, and the accumulator is just
a closed-over local.

Output is byte-identical (`each_header` is `Rack::Request::Env#each_header`,
i.e. full env iteration; the `HTTP_` filter is unchanged). `build_headers`
runs lazily, only when an endpoint reads `headers`.

Measured on a request with ~30 headers: ~43% fewer objects (37 -> 21 per
call) and ~1.36x faster, with the array packing — not the Enumerator object
itself — accounting for the entire gap.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pull Request #2770: Avoid per-entry array allocation in Request#build_headers

1127 of 1225 branches covered (92.0%)

Branch coverage included in aggregate %.

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

3580 of 3648 relevant lines covered (98.14%)

23080.07 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/multi_json.gemfile - 27902723616.1 21 Jun 2026 11:23AM UTC 166
47.5
GitHub Action Run
2 run-4.0-gemfiles/dry_validation.gemfile - 27902723616.2 21 Jun 2026 11:24AM UTC 166
58.19
GitHub Action Run
3 run-3.3-gemfiles/rack_3_2.gemfile - 27902723616.3 21 Jun 2026 11:23AM UTC 166
95.13
GitHub Action Run
4 run-3.4-Gemfile - 27902723616.4 21 Jun 2026 11:23AM UTC 166
95.13
GitHub Action Run
5 run-3.3-gemfiles/rack_2_2.gemfile - 27902723616.5 21 Jun 2026 11:23AM UTC 166
95.09
GitHub Action Run
6 run-4.0-gemfiles/multi_xml_0_8.gemfile - 27902723616.6 21 Jun 2026 11:24AM UTC 166
47.01
GitHub Action Run
7 run-4.0-gemfiles/rack_3_0.gemfile - 27902723616.7 21 Jun 2026 11:23AM UTC 166
95.13
GitHub Action Run
8 run-3.3-gemfiles/rails_8_0.gemfile - 27902723616.8 21 Jun 2026 11:24AM UTC 167
95.13
GitHub Action Run
9 run-4.0-gemfiles/rails_8_1.gemfile - 27902723616.9 21 Jun 2026 11:23AM UTC 167
95.13
GitHub Action Run
10 run-3.3-Gemfile - 27902723616.10 21 Jun 2026 11:23AM UTC 166
95.13
GitHub Action Run
11 run-3.4-gemfiles/rack_3_0.gemfile - 27902723616.11 21 Jun 2026 11:24AM UTC 166
95.13
GitHub Action Run
12 run-3.4-gemfiles/rack_3_2.gemfile - 27902723616.12 21 Jun 2026 11:24AM UTC 166
95.13
GitHub Action Run
13 run-4.0-gemfiles/rails_7_2.gemfile - 27902723616.13 21 Jun 2026 11:24AM UTC 167
95.13
GitHub Action Run
14 run-3.3-gemfiles/rack_3_0.gemfile - 27902723616.14 21 Jun 2026 11:24AM UTC 166
95.13
GitHub Action Run
15 run-4.0-gemfiles/grape_swagger.gemfile - 27902723616.15 21 Jun 2026 11:24AM UTC 166
55.15
GitHub Action Run
16 run-3.3-gemfiles/rails_7_2.gemfile - 27902723616.16 21 Jun 2026 11:24AM UTC 167
95.13
GitHub Action Run
17 run-4.0-Gemfile - 27902723616.17 21 Jun 2026 11:24AM UTC 166
95.13
GitHub Action Run
18 run-3.4-gemfiles/rack_3_1.gemfile - 27902723616.18 21 Jun 2026 11:24AM UTC 166
95.13
GitHub Action Run
19 run-4.0-gemfiles/rack_2_2.gemfile - 27902723616.19 21 Jun 2026 11:24AM UTC 166
95.09
GitHub Action Run
20 run-3.3-gemfiles/rails_8_1.gemfile - 27902723616.20 21 Jun 2026 11:23AM UTC 167
95.13
GitHub Action Run
21 run-3.3-gemfiles/rack_3_1.gemfile - 27902723616.21 21 Jun 2026 11:24AM UTC 166
95.13
GitHub Action Run
22 run-3.4-gemfiles/rails_7_2.gemfile - 27902723616.22 21 Jun 2026 11:24AM UTC 167
95.13
GitHub Action Run
23 run-4.0-gemfiles/rack_3_2.gemfile - 27902723616.23 21 Jun 2026 11:24AM UTC 166
95.13
GitHub Action Run
24 run-3.4-gemfiles/rails_8_0.gemfile - 27902723616.24 21 Jun 2026 11:24AM UTC 167
95.13
GitHub Action Run
25 run-4.0-gemfiles/hashie.gemfile - 27902723616.25 21 Jun 2026 11:23AM UTC 166
62.32
GitHub Action Run
26 run-4.0-gemfiles/multi_json_1_20.gemfile - 27902723616.26 21 Jun 2026 11:24AM UTC 166
47.54
GitHub Action Run
27 run-3.4-gemfiles/rack_2_2.gemfile - 27902723616.27 21 Jun 2026 11:24AM UTC 166
95.09
GitHub Action Run
28 run-4.0-gemfiles/grape_entity.gemfile - 27902723616.28 21 Jun 2026 11:23AM UTC 166
50.22
GitHub Action Run
29 run-4.0-gemfiles/multi_xml.gemfile - 27902723616.29 21 Jun 2026 11:24AM UTC 166
46.97
GitHub Action Run
30 run-4.0-gemfiles/rails_8_0.gemfile - 27902723616.30 21 Jun 2026 11:24AM UTC 167
95.13
GitHub Action Run
31 run-4.0-gemfiles/rack_3_1.gemfile - 27902723616.31 21 Jun 2026 11:24AM UTC 166
95.13
GitHub Action Run
32 run-3.4-gemfiles/rails_8_1.gemfile - 27902723616.32 21 Jun 2026 11:23AM UTC 167
95.13
GitHub Action Run
Source Files on build 27902723616
  • Tree
  • List 167
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #27902723616
  • Pull Request #2770
  • PR Base - master (#27881937273)
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