Skip to content

Commit

Permalink
Do not parallelize definition building if it gives no advantage
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 Apr 29, 2024
1 parent 503ccc4 commit cfce3dd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
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 cfce3dd

Please sign in to comment.