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

ruby-grape / grape / 24696174073 / 12
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: v3.3.1
DEFAULT BRANCH: master
Ran 20 Apr 2026 11:47PM UTC
Files 155
Run time 5s
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:44PM UTC coverage: 95.612% (+0.003%) from 95.609%
24696174073.12

Pull #2691

github

ericproulx
Precompute prefix list in Versioner::Path

`Versioner::Path#before` built `[mount_path, Grape::Router.normalize_path(prefix)]`
on every request and iterated it, filtering nil/empty/'/' entries with a guard
clause on each element. Both `mount_path` and `prefix` are fixed at mount time,
so this work is redundant.

Memoize a pre-filtered `@prefixes` array in `initialize` (the middleware dup in
`Middleware::Base#call` shallow-copies ivars, so the frozen array is shared
across request dups for free). The per-request loop simplifies to
`if path_info.start_with?(path)`.

## Benchmark (1k iterations)

  current                    1.09 M i/s, 80KB / 2k objects
  variant A (memoize normalize) 1.34 M i/s, 80KB / 2k objects
  variant B (memoize list)   2.61 M i/s, 40KB / 1k objects  (2.38x faster, 2x fewer)

Shipping variant B.

No behavior change; all 2,236 specs pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2691: Precompute prefix list in Versioner::Path

1045 of 1155 branches covered (90.48%)

Branch coverage included in aggregate %.

3313 of 3403 relevant lines covered (97.36%)

1006.31 hits per line

Source Files on job run-4.0-gemfiles/rails_7_2.gemfile - 24696174073.12
  • Tree
  • List 155
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 24696174073
  • dc7c8e81 on github
  • Prev Job for on perf/versioner-path-prefix (#24693877550.27)
  • Next Job for on perf/versioner-path-prefix (#24696315567.13)
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