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

Use System.identityHashCode in Attribute#hashCode #5

Open
norswap opened this issue May 12, 2022 · 0 comments
Open

Use System.identityHashCode in Attribute#hashCode #5

norswap opened this issue May 12, 2022 · 0 comments

Comments

@norswap
Copy link
Owner

norswap commented May 12, 2022

  • Attribute#equals uses object identity to compares its fields, so its unecessary (and in fact, potentially counter-productive) to compute the full hashCode of its fields in the hashCode method.
  • A student stumbled upon an issue where the hashCode of the Attribute changed because he made a change to the underyling AST. While this is not strictly a bug (AST should be immutable), it would have been avoided by using identityHashCode.
  • This will improve performance a lot: the current implem of SighNode#hashCode uses reflection and is very inefficient.
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

No branches or pull requests

1 participant