On Fri, 11 Feb 2022 18:13:36 GMT, Roger Riggs <rri...@openjdk.org> wrote:
>> @RogerRiggs >> so you recommend `(int) Math.min(((m.size() * 4L + 2L) / 3L), >> Integer.MAX_VALUE)`? OK then, changed it. >> please review again, thanks! > > Works for me. Thanks Just multiply by 0.75. On a modern design, floating-point multiply is 4 clocks latency, 4 ops/clock throughput. FP max is 2 clocks latency, conversions int-float and vice versa 3 clocks latency, 4 ops/clock throughput. Long division is 7-9 clocks, 2ops/clock throughput. Shift and add 2 clocks, 2/3 ops/clock througput. Compare is 1 clock, 3 ops/clock throughput, conditional move is 1 clock, 3 ops/clock throughput. Seems like it's a wash. ------------- PR: https://git.openjdk.java.net/jdk/pull/7431