RFR: 8306075: Micro-optimize Enum.hashCode [v2]
Aleksey Shipilev
shade at openjdk.org
Tue Apr 18 19:35:48 UTC 2023
On Tue, 18 Apr 2023 19:23:59 GMT, Viktor Klang <duke at openjdk.org> wrote:
> In such a case, would it not be "better" to base the HC on getClass().getName().hashCode() which is specced and stable mixed with the ordinal to improve distribution over the 32-bit space?
Maybe, even though it still raises lots of collision-resistance questions, given that both `String` (class) name and ordinal are constructable, and have hash codes that are easy to collide. Anyhow, I strongly believe this goes way beyond the scope of this PR.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13491#issuecomment-1513688458
More information about the core-libs-dev
mailing list