Skip to content

Commit

Permalink
Do not parallelize definition building if it gives no advantage (#10776)
Browse files Browse the repository at this point in the history
For the cases when there are 1 or 2 cores the fork join pool is of size 1 and therefore does not achieve parallelized execution. For this case we can load definitions on the main thread.
  • Loading branch information
andriy-dmytruk committed May 3, 2024
1 parent 86914a7 commit 4b2e3cc
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -239,7 +239,7 @@ public void collect(Collection<S> values) {

@Override
public void collect(Collection<S> values, boolean allowFork) {
if (allowFork) {
if (allowFork && ForkJoinPool.getCommonPoolParallelism() > 1) {
ForkJoinPool.commonPool().invoke(this);
for (RecursiveActionValuesCollector<S> task : tasks) {
task.join();
Expand Down

0 comments on commit 4b2e3cc

Please sign in to comment.