-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
8
As described in JDK-8227006 the addition of container support has slowed down the execution of Runtime.availableProcessors. By calling this function in its spin-loop waitingGet() can also suffer from a severe slowdown in performance.
spins = (Runtime.getRuntime().availableProcessors() > 1) ?
1 << 8 : 0; // Use brief spin-wait on multiprocessors
As we only care about >1 processors we can cache this value in a field. The only problem case would be a >1 to 1 transition which is an unlikely change. If it did occur it would only result in a small performance hit anyway.
This fix is only needed for 8u as 9 and later have different code due toJDK-8157522
spins = (Runtime.getRuntime().availableProcessors() > 1) ?
1 << 8 : 0; // Use brief spin-wait on multiprocessors
As we only care about >1 processors we can cache this value in a field. The only problem case would be a >1 to 1 transition which is an unlikely change. If it did occur it would only result in a small performance hit anyway.
This fix is only needed for 8u as 9 and later have different code due to
- duplicates
-
JDK-8227018 CompletableFuture should not call Runtime.availableProcessors on fast path
- Resolved
- relates to
-
JDK-8157522 Performance improvements to CompletableFuture
- Resolved
-
JDK-8227006 [linux] Runtime.availableProcessors execution time increased by factor of 100
- Resolved