RFR: 8300184: Optimize ResourceHashtableBase::iterate_all using _number_of_entries

Xin Liu xliu at openjdk.org
Mon Jan 16 19:57:55 UTC 2023


Current implementation needs to visit all buckets. In extreme case, an empty hashtable with 1k buckets. 
iterate_all() has to load 1k buckets for nothing.  

_number_of_entries is the number of nodes in the hashtable. This patch leverages that to quit iteration earlier. 
The real effect is up to the distribution of nodes among buckets.

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

Commit messages:
 - 8300184: Optimize ResourceHashtableBase::iterate_all using _number_of_entries

Changes: https://git.openjdk.org/jdk/pull/12016/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12016&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8300184
  Stats: 12 lines in 1 file changed: 11 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/12016.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12016/head:pull/12016

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


More information about the hotspot-dev mailing list