Integrated: 8306075: Micro-optimize Enum.hashCode

2023-04-21 Thread olivergillespie
On Mon, 17 Apr 2023 10:59:34 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

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v6]

2023-04-20 Thread olivergillespie
On Mon, 17 Apr 2023 16:42:38 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;

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v6]

2023-04-17 Thread olivergillespie
on in the [original enhancement > request](https://bugs.openjdk.org/browse/JDK-8306075). [Benchmark results and > generated code analysis moved to comment] > > Thanks @shipilev for help with the implementation and interpreting the > generated code. olivergillespie has updated t

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v4]

2023-04-17 Thread olivergillespie
On Mon, 17 Apr 2023 14:15:39 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;

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v5]

2023-04-17 Thread olivergillespie
on in the [original enhancement > request](https://bugs.openjdk.org/browse/JDK-8306075). [Benchmark results and > generated code analysis moved to comment] > > Thanks @shipilev for help with the implementation and interpreting the > generated code. olivergillespie has updated t

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v4]

2023-04-17 Thread olivergillespie
On Mon, 17 Apr 2023 15:30:52 GMT, Alan Bateman wrote: >> I would change this to be an non-javadoc comment. (Change /** to /*) >> An there is no need for javadoc \implNote or @link javadoc markup. >> There is very little value in being able to generate javadoc for --private. >> (In part because m

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v4]

2023-04-17 Thread olivergillespie
0x10(%r12,%r10,8),%r8d <-- read the hash > field > │ 0x7f550068e3b9: test %r8d,%r8d <-- if (hash == 0) > │ 0x7f550068e3bc: je 0x7f550068e413 <-- slow init path, > only taken on first use > > > Thanks @shipilev for h

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v2]

2023-04-17 Thread olivergillespie
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

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v3]

2023-04-17 Thread olivergillespie
On Mon, 17 Apr 2023 13:27:43 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;

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v3]

2023-04-17 Thread olivergillespie
0x10(%r12,%r10,8),%r8d <-- read the hash > field > │ 0x7f550068e3b9: test %r8d,%r8d <-- if (hash == 0) > │ 0x7f550068e3bc: je 0x7f550068e413 <-- slow init path, > only taken on first use > > > Thanks @shipilev for he

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v2]

2023-04-17 Thread olivergillespie
0x10(%r12,%r10,8),%r8d <-- read the hash > field > │ 0x7f550068e3b9: test %r8d,%r8d <-- if (hash == 0) > │ 0x7f550068e3bc: je 0x7f550068e413 <-- slow init path, > only taken on first use > > > Thanks @sh

RFR: 8306075: Micro-optimize Enum.hashCode

2023-04-17 Thread olivergillespie
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 this new