The DefaultRandomFunction was refactored to use a fixed pool of SecureRandom. The previous implementation used a thread local SecureRandom.
The thread pool SIZE is equal to the number of processors (or cores) available to the runtime. For example, if there's only 1 processor available, the pool size will be 1. If there are 16 processors available, the pool size will be 16. The maximum pool size is 32.
The current INDEX in the thread pool is calculated with this formula: INDEX = CURRENT_THREAD_ID % POOL_SIZE.
A BENCHMARK using a high number of threads (100) showed that the fixed pool performs almost the same as the thread local to generate random numbers using the SHA1PRNG algorithm.
The
DefaultRandomFunction
was refactored to use a fixed pool ofSecureRandom
. The previous implementation used a thread localSecureRandom
.The thread pool SIZE is equal to the number of processors (or cores) available to the runtime. For example, if there's only 1 processor available, the pool size will be 1. If there are 16 processors available, the pool size will be 16. The maximum pool size is 32.
The current INDEX in the thread pool is calculated with this formula:
INDEX = CURRENT_THREAD_ID % POOL_SIZE
.A BENCHMARK using a high number of threads (100) showed that the fixed pool performs almost the same as the thread local to generate random numbers using the SHA1PRNG algorithm.
Benchmark settings: