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

ruby-grape / grape / 26722632890

31 May 2026 07:45PM UTC coverage: 96.865% (+0.004%) from 96.861%
26722632890

Pull #2753

github

ericproulx
Lazy-allocate ParamScopeTracker's identity hashes

ParamScopeTracker eagerly built two {}.compare_by_identity hashes in its
constructor, so every validating request allocated both even though many
validators (presence, coercion of flat params) never touch either tracker.

Replace the eager initialize with memoized private accessors that allocate
each hash on first use. Behaviour is unchanged: reads still return nil /
EMPTY_PARAMS when nothing was stored.

In a mixed-endpoint memory_profiler run this drops the two allocation sites
from ~1,900 to ~500 objects each (~0.72 MB / ~2,800 fewer objects overall).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pull Request #2753: Lazy-allocate ParamScopeTracker's identity hashes

1103 of 1193 branches covered (92.46%)

Branch coverage included in aggregate %.

3531 of 3591 relevant lines covered (98.33%)

23292.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.15
/lib/grape/exceptions/validation_errors.rb


Source Not Available

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