RFR: 7903554: JMH: add Threads.HALF_MAX constant [v3]

Sergey Kuksenko skuksenko at openjdk.org
Mon Sep 11 22:27:05 UTC 2023


On Fri, 8 Sep 2023 19:57:48 GMT, Sergey Kuksenko <skuksenko at openjdk.org> wrote:

>> add Threads.HALF_MAX constant equals to "Runtime.getRuntime().availableProcessors()/2"
>
> Sergey Kuksenko has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix test

There are a couple of widely used use cases.
1. Check HT impact to compare MAX vs HALF_MAX.
2. Benchmarking async functions. In this case, benchmark threads don't do actual work; just submit tasks and count.  For small functions the best CPU utilization is achieved when number of submitting threads == HALF_MAX

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

PR Comment: https://git.openjdk.org/jmh/pull/118#issuecomment-1714666064


More information about the jmh-dev mailing list