FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add comparison for method vs forwarded method vs delegated method by yogeshjain999 · Pull Request #182 · fastruby/fast-ruby · GitHub

Add comparison for method vs forwarded method vs delegated method - #182

Open
yogeshjain999 wants to merge 1 commit into
fastruby:mainfrom
yogeshjain999:method-delegations
Open

Add comparison for method vs forwarded method vs delegated method#182
yogeshjain999 wants to merge 1 commit into
fastruby:mainfrom
yogeshjain999:method-delegations

Conversation

Copy link
Copy Markdown

Add benchmarks to understand when to define method explicitly, forward method with def_delegator or use SimpleDelegator.

Copy link
Copy Markdown
Author

Hey guys, any updates on this ?

nirvdrum commented Apr 9, 2021

Copy link
Copy Markdown
Collaborator

I just tried running this locally and the benchmark doesn't work with Ruby 2.7. It looks like you need to add require 'delegate'.

Copy link
Copy Markdown
Author

@nirvdrum Thanks, fixed it.

It seem the difference between forwarded and delegated method has been increased in ruby >= 2.7.

Warming up --------------------------------------
              method   307.381k i/100ms
    forwarded method   228.038k i/100ms
    delegated method   110.079k i/100ms
Calculating -------------------------------------
              method      3.103M (± 0.9%) i/s -     15.676M in   5.052459s
    forwarded method      2.299M (± 1.2%) i/s -     11.630M in   5.059510s
    delegated method      1.102M (± 0.9%) i/s -      5.614M in   5.095893s

Comparison:
              method:  3102988.8 i/s
    forwarded method:  2298988.2 i/s - 1.35x  (± 0.00) slower
    delegated method:  1101769.4 i/s - 2.82x  (± 0.00) slower

krtschmr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nice one

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL