On Wed, 23 Mar 2022 18:41:59 GMT, XenoAmess <[email protected]> wrote:
> 8186958: Need method to create pre-sized HashMap
@stuart-marks
I think making these functions at Collections is slightly better than place
them to their own classes.
The first step is to make such functions.
The second step is to change some usage to these functions.
I ran the jmh locally, and find it far better performance to use int
calculations, than double.
Benchmark Mode Cnt
Score Error Units
CalculateHashMapCapacityTestJMH.testCalculateHashMapCapacity1 thrpt 50
0.429 �� 0.006 ops/s
CalculateHashMapCapacityTestJMH.testCalculateHashMapCapacity2 thrpt 50
4703157194.777 �� 25674718.597 ops/s
CalculateHashMapCapacityTestJMH.testCalculateHashMapCapacity3 thrpt 50
4729596276.529 �� 16516214.791 ops/s
-------------
PR: https://git.openjdk.java.net/jdk/pull/7928