Skip to content

Deprecate ObjectSpace._id2ref #13157

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

casperisfine
Copy link
Contributor

[Feature #15408]

Matz decided to deprecate it for Ruby 2.6 or 2.7 but that never actually happened.

Given the object_id table is a contention point for Ractors it seems sensible to finally deprecate this API so we can generate and store object ids more efficiently in the future.

[Feature #15408]

Matz decided to deprecate it for Ruby 2.6 or 2.7 but that never
actually happened.

Given the object_id table is a contention point for Ractors
it seems sensible to finally deprecate this API so we can
generate and store object ids more efficiently in the future.
Copy link

launchable-app bot commented Apr 23, 2025

All Tests passed!

✖️no tests failed ✔️61694 tests passed(2 flakes)

casperisfine pushed a commit to Shopify/sorbet that referenced this pull request Apr 23, 2025
This method was supposed to be deprecated for Ruby 2.7 but fell
through the cracks, I'm working on making it happen: ruby/ruby#13157

In addition, Ruby 3.5.0 already has some optimizations in place that
are de-optimized if `_id2ref` is ever called: ruby/ruby#13115

And one more issue is that `_id2ref` doesn't work well with ractors.

Instead we can hold our own weakmap. It's probably not the ideal
implementation, but I chose to not go for too large of a refactor
given my limited familiarity with sorbet.
casperisfine pushed a commit to Shopify/sorbet that referenced this pull request Apr 24, 2025
This method was supposed to be deprecated for Ruby 2.7 but fell
through the cracks, I'm working on making it happen: ruby/ruby#13157

In addition, Ruby 3.5.0 already has some optimizations in place that
are de-optimized if `_id2ref` is ever called: ruby/ruby#13115

And one more issue is that `_id2ref` doesn't work well with ractors.

Instead we can hold our own weakmap. It's probably not the ideal
implementation, but I chose to not go for too large of a refactor
given my limited familiarity with sorbet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants