> 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 field can 
> slot in 'for free'. In other cases, the singleton nature of enum values means 
> that the number of total instances is typically very low, so a small 
> per-instance overhead is not a concern.
> 
> Please see more discussion/explanation 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 the pull request incrementally with one additional 
commit since the last revision:

  Switch to non-javadoc comment and remove markup

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/13491/files
  - new: https://git.openjdk.org/jdk/pull/13491/files/79af4952..f4b5c546

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13491&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13491&range=03-04

  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/13491.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13491/head:pull/13491

PR: https://git.openjdk.org/jdk/pull/13491

Reply via email to