Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeTranslator optimization #1944

Merged

Conversation

ericproulx
Copy link
Contributor

Still memory profiling

Allocated String Report
-----------------------------------
      7640  "d"
      3820  /Users/eproulx/.rbenv/versions/2.4.9/lib/ruby/gems/2.4.0/gems/grape-1.2.6/lib/grape/router/attribute_translator.rb:16
      3820  /Users/eproulx/.rbenv/versions/2.4.9/lib/ruby/gems/2.4.0/gems/grape-1.2.6/lib/grape/router/attribute_translator.rb:18

      1248  "s"
       624  /Users/eproulx/.rbenv/versions/2.4.9/lib/ruby/gems/2.4.0/gems/grape-1.2.6/lib/grape/router/attribute_translator.rb:16
       624  /Users/eproulx/.rbenv/versions/2.4.9/lib/ruby/gems/2.4.0/gems/grape-1.2.6/lib/grape/router/attribute_translator.rb:18

       936  "p"
       468  /Users/eproulx/.rbenv/versions/2.4.9/lib/ruby/gems/2.4.0/gems/grape-1.2.6/lib/grape/router/attribute_translator.rb:16
       468  /Users/eproulx/.rbenv/versions/2.4.9/lib/ruby/gems/2.4.0/gems/grape-1.2.6/lib/grape/router/attribute_translator.rb:18

d = request_method
s = :requirements
p = regexp

Instead of using method_missing to fetch the data, I thought it would be better to define the methods

…d_missing since it's defined by defaults.

Added regexp and index in Any class instead of falling back on method_missing
@grape-bot
Copy link

grape-bot commented Dec 14, 2019

1 Warning
⚠️ There’re library changes, but not tests. That’s OK as long as you’re refactoring existing code.

Generated by 🚫 danger

@dblock
Copy link
Member

dblock commented Dec 15, 2019

Good stuff. See my comment above.

@dblock dblock merged commit afcca35 into ruby-grape:master Dec 15, 2019
@dblock
Copy link
Member

dblock commented Dec 15, 2019

👍 merged

basjanssen pushed a commit to basjanssen/grape that referenced this pull request Feb 28, 2020
Added request_method and requirements has methods instead using method_missing since it's defined by defaults. Added regexp and index in Any class instead of falling back on method_missing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants