Internal function to determine if an operation should use parallel processing based on the number of items to process and current configuration.
Details
This function returns TRUE only if:
Parallel processing is enabled (via
set_parallel_plan())The number of items
nis at leastthreshold
For small numbers of items, the overhead of parallelization typically outweighs the benefits, so sequential processing is used.
Examples
if (FALSE) { # \dontrun{
# With parallel processing enabled
set_parallel_plan("multisession")
should_parallelize(5) # FALSE (below threshold)
should_parallelize(20) # TRUE (above threshold)
# With parallel processing disabled
set_parallel_plan("sequential")
should_parallelize(100) # FALSE (sequential plan)
} # }