On Tue, 18 Apr 2023 19:23:59 GMT, Viktor Klang 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 co
On Tue, 18 Apr 2023 09:02:34 GMT, Aleksey Shipilev wrote:
>>> > > Why isn't `Enum::hashCode` simply doing `return ordinal;`?
>>> >
>>> >
>>> > See https://bugs.openjdk.org/browse/JDK-8050217
>>>
>>> Thanks! If there are apps where `Enum::hashCode` is performance sensitive
>>> then run-to-run
On Mon, 17 Apr 2023 21:12:58 GMT, Jorn Vernee wrote:
> (if anything, using the ordinal would be _more_ stable, since it is only
> affected by the order of the constants, rather than by other code that runs
> before the identity hash code is generated).
Here lies the major original concern -- t
On Mon, 17 Apr 2023 13:40:02 GMT, Claes Redestad wrote:
> > > Why isn't `Enum::hashCode` simply doing `return ordinal;`?
> >
> >
> > See https://bugs.openjdk.org/browse/JDK-8050217
>
> Thanks! If there are apps where `Enum::hashCode` is performance sensitive
> then run-to-run stability may be
On Mon, 17 Apr 2023 13:27:43 GMT, olivergillespie wrote:
> > Why isn't `Enum::hashCode` simply doing `return ordinal;`?
>
> See https://bugs.openjdk.org/browse/JDK-8050217
Thanks! If there are apps where `Enum::hashCode` is performance sensitive then
run-to-run stability may be a stronger argu
On Mon, 17 Apr 2023 13:26:49 GMT, Claes Redestad wrote:
> Why isn't `Enum::hashCode` simply doing `return ordinal;`?
See https://bugs.openjdk.org/browse/JDK-8050217
-
PR Comment: https://git.openjdk.org/jdk/pull/13491#issuecomment-1511350037
On Mon, 17 Apr 2023 13:23:35 GMT, olivergillespie wrote:
>> Improve the speed of Enum.hashCode by caching the identity hashcode on first
>> use. I've seen an application where Enum.hashCode is a hot path, and this is
>> fairly simple speedup. The memory overhead is low; in enums with no extra
> Improve the speed of Enum.hashCode by caching the identity hashcode on first
> use. I've seen an application where Enum.hashCode is a hot path, and this is
> fairly simple speedup. The memory overhead is low; in enums with no extra
> fields there is already a 4-byte space due to alignment so t