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

Optimize #add_referenced #238

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

Commits on Feb 1, 2024

  1. Optimize #add_referenced

    The #add_referenced kept track of existing object with a hash when the keys
    were the objects. This seemed to have been ok with Ruby 2.7, but became
    significantly slower in Ruby 3.2.
    
    Profiling showed that many of those objects are instances of Hash and Ruby
    uses #eql? method to compare Hash keys. It is not clear what acutally changed
    in Ruby, but we can work around the issue by using #hash so that the key
    is an integer. We just need to recompute that integer if the object changes.
    
    Co-authored-by: Jeremy Kirchhoff <[email protected]>
    pkmiec and jeremykirc committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    596e894 View commit details
    Browse the repository at this point in the history