Skip to content

Replace object_id comparison with identity Hash - #7303

Merged
martinemde merged 1 commit into
ruby:masterfrom
amomchilov:remove-object_id-use
Dec 19, 2023
Merged

martinemde merged 1 commit into
ruby:masterfrom
amomchilov:remove-object_id-use

Conversation

@amomchilov

@amomchilov amomchilov commented Dec 18, 2023 •

Copy link
Copy Markdown
Contributor

What was the end-user or developer problem that led to this PR?

Found this while auditing uses of object_id in ruby/ruby. Pulled out from ruby/ruby#9276

What is your fix for the problem, implemented in this PR?

Replace a Hash keyed by object_ids with an identity Hash. See Hash#compare_by_identity](https://ruby-doc.org/3.2.2/Hash.html#method-i-compare_by_identity), which has the same semantics, but is faster and doesn't trigger allocation of IDs for these objects.

Make sure the following tasks are checked

@welcome

welcome Bot commented Dec 18, 2023

Copy link
Copy Markdown

Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality.

We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below.

If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems or #bundler channel on Slack.

For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide

@martinemde
martinemde merged commit 6d4b73f into ruby:master Dec 19, 2023
@amomchilov

Copy link
Copy Markdown
Contributor Author

Thanks for merging! @martinemde

@martinemde

Copy link
Copy Markdown
Contributor

@amomchilov I did the easy part 😀 Thank you for finding and contributing this back to rubygems!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants