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

Imrpove performance by limitting on_send calls #1117

Merged
merged 1 commit into from Jan 10, 2021

Conversation

Darhazer
Copy link
Member

@Darhazer Darhazer commented Jan 10, 2021

I noticed that Rubocop, since v0.90, has an optimization for not calling on_send based on the expected method_name for the cop.

I applied that to the cops for it was easy (which is about 50% of the cops). Due to the configurable language, it might be hard to do for some cops, and for others, it just requires more refactoring, as the cops check for a method somewhere down the chain.

I haven't really measured the performance improvement, but a naive test (running it with time over our own specs) shows a significant difference.

cc: @fatkodima


Before submitting the PR make sure the following are checked:

  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Updated documentation.
  • Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

Copy link

@fatkodima fatkodima left a comment

Choose a reason for hiding this comment

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

👍 Yeah, this definitely should make a noticeable difference.

@marcandre
Copy link
Contributor

Perfect!
It's always faster to use RESTRICT_ON_SEND whenever possible, no need to benchmark it 👍
Thanks!

@marcandre marcandre merged commit d58a043 into master Jan 10, 2021
@marcandre marcandre deleted the improve-on-send-performance branch January 10, 2021 23:56
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.

None yet

3 participants